BookmarkSubscribeRSS Feed
Ella2525
Calcite | Level 5

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

3 REPLIES 3
Reeza
Super User
You say Excel CSV and then use DBMS=Excel and xls. Can you confirm exactly what is your desired file type? Is there any error messaged in your log? What does 'not execute' mean?
Ella2525
Calcite | Level 5

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. 

pau13rown
Lapis Lazuli | Level 10

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;

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1206 views
  • 3 likes
  • 3 in conversation