Hello,
I have a large data-set that I had to split into 360 smaller sets by value (byval), I need to export the smaller sets into individuals excel files .csv and im having trouble coming up with the proc export. Here is what i'm doing:
Proc sort data = HQ.private; by hospital_system; run;
%macro break(byval);
data &byval;
set HQ.private(where=(hospital_system="&byval"));
run;
%mend;
Data _Null_;
set HQ.private;
by hospital_system;
if first.hospital_system then
call execute(%nrstr('%break('||trim(hospital_system)||')'));
run;
proc export
DATA=work.pih
DBMS=EXCEL
outfile="C:\Users\ekala1\Documents\HQAF\pih.xls"
replace;
run;
When I run my proc export, it does not execute. Any help or advice would be greatly appreciated.
Thank you,
Ella
Hello Reeza, either will work xls or csv; also I am not getting any error messages my log. When i look in the designated folder the files are not there.
myabe im stupid but i dont see where the temp data set pih is created. Why not:
%macro break(byval);
data &byval;
set HQ.private(where=(hospital_system="&byval"));
run;
proc export
DATA=&byvar
DBMS=EXCEL
outfile="C:\Users\ekala1\Documents\HQAF\&byvar.xls"
replace;
run;
%mend;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.