I have the following simple macro
%macro hospseq (DSN=,NDSN=);
data new2019; set &DSN; run; %YEARSTEP(YEAR =2019 );
proc datasets library=work nolist; change cake2_2019=&NDSN; quit; run;
proc export data=&NDSN outfile="s:\smm\excel\&ndsn" dbms=csv replace; run;
%mend hospseq;
When I run the macro using the parameters below it produces the output file MS2019_ALLcsv. What do I need to do to make the macro produce the CSV file with the CSV extension. So I get
MS2019_all.CSV instead of MS2019_allcsv . If I manually rename the file from MS2019_allCSV to MS2019_All.CSV the file is in the proper format. Thanks for any suggestions.
Larry
%HOSPSEQ(DSN=smm2019,NDSN=MS2019_All);
@Larry3Smith wrote:
I have the following simple macro
%macro hospseq (DSN=,NDSN=);
data new2019; set &DSN; run; %YEARSTEP(YEAR =2019 );
proc datasets library=work nolist; change cake2_2019=&NDSN; quit; run;
proc export data=&NDSN outfile="s:\smm\excel\&ndsn" dbms=csv replace; run;
%mend hospseq;
When I run the macro using the parameters below it produces the output file MS2019_ALLcsv. What do I need to do to make the macro produce the CSV file with the CSV extension. So I get
MS2019_all.CSV instead of MS2019_allcsv . If I manually rename the file from MS2019_allCSV to MS2019_All.CSV the file is in the proper format. Thanks for any suggestions.
Larry
%HOSPSEQ(DSN=smm2019,NDSN=MS2019_All);
Probably need to show us the code in that YEARSTEP macro as none of the code you show creates anything ending in CSV.
Somewhere you likely have a macro variable followed by .csv that needs to have ..csv.
Example:
%let var=ABC;
%put &var.csv;
%put &var..csv;
The macro language uses a single dot to indicate the end of the variable. So you need to have the second to be in the resolved value.
@Larry3Smith wrote:
I have the following simple macro
%macro hospseq (DSN=,NDSN=);
data new2019; set &DSN; run; %YEARSTEP(YEAR =2019 );
proc datasets library=work nolist; change cake2_2019=&NDSN; quit; run;
proc export data=&NDSN outfile="s:\smm\excel\&ndsn" dbms=csv replace; run;
%mend hospseq;
When I run the macro using the parameters below it produces the output file MS2019_ALLcsv. What do I need to do to make the macro produce the CSV file with the CSV extension. So I get
MS2019_all.CSV instead of MS2019_allcsv . If I manually rename the file from MS2019_allCSV to MS2019_All.CSV the file is in the proper format. Thanks for any suggestions.
Larry
%HOSPSEQ(DSN=smm2019,NDSN=MS2019_All);
Probably need to show us the code in that YEARSTEP macro as none of the code you show creates anything ending in CSV.
Somewhere you likely have a macro variable followed by .csv that needs to have ..csv.
Example:
%let var=ABC;
%put &var.csv;
%put &var..csv;
The macro language uses a single dot to indicate the end of the variable. So you need to have the second to be in the resolved value.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.