data one;
input id $;
/* create formatting to preserve leading zeros in excel */
cid  =  ' = " '  ||  id  ||  ' " ';
cards;
00123
12398
01234
00034
;
run;
data one (drop=id);
      set one;
run;
ods listing close;
ods csv file='lead0.csv' ;
      proc print data=one noobs;
      run;
ods csv close;
Showing posts with label SAS to Oracle/EXCEL. Show all posts
Showing posts with label SAS to Oracle/EXCEL. Show all posts
Friday, April 1, 2011
Tuesday, January 4, 2011
Create Oracle Tables
libname oradb Oracle User=orauser Password=xxxxxxx Path="@orapth";
proc sql;
      create table oradb.dsn as
      select * from temp;
quit;
run;
proc append base=oradb.dsn data=temp1 force;
run;
proc sql;
      create table oradb.dsn as
      select * from temp;
quit;
run;
proc append base=oradb.dsn data=temp1 force;
run;
Tuesday, November 23, 2010
Thursday, March 11, 2010
Saturday, December 19, 2009
Seperate data into EXCEL sheets
%macro multisheet;
proc sql noprint;
select distinct age
into :idage1 - :idage99
from sashelp.class;
%let agecnt = &sqlobs;
quit;
%do i = 1 %to &agecnt;
PROC EXPORT DATA = sashelp.class(where=(age=&&idage&i))
OUTFILE="C:\temp\class_ages.xls"
DBMS= excel
REPLACE;
sheet = "Age_&&idage&i";
RUN;
%END;
%mend multisheet;
%multisheet
proc sql noprint;
select distinct age
into :idage1 - :idage99
from sashelp.class;
%let agecnt = &sqlobs;
quit;
%do i = 1 %to &agecnt;
PROC EXPORT DATA = sashelp.class(where=(age=&&idage&i))
OUTFILE="C:\temp\class_ages.xls"
DBMS= excel
REPLACE;
sheet = "Age_&&idage&i";
RUN;
%END;
%mend multisheet;
%multisheet
Friday, December 4, 2009
List Oracle tables in SAS
C-TASC specific
libname oralib ORACLE user=ctpmstat path="@xxxx" password = xxxxxxx;
proc freq data = oralib.all_tables;
tables owner * table_name/list;
run;
libname oralib ORACLE user=ctpmstat path="@xxxx" password = xxxxxxx;
proc freq data = oralib.all_tables;
tables owner * table_name/list;
run;
Subscribe to:
Posts (Atom)