BookmarkSubscribeRSS Feed
jeetendersinghc
Fluorite | Level 6

Hi,

I want the output of of only second datasets "test2" in excel file. However i am getting the output of test as well as test 2 also. Can you please suggest me what changes i need to have in my program to have the correct output. 

proc sort data=diagnosis out=diag;
by patid;
run;


ods tagsets.excelxp file="location of excel file\test.xml" style=sasweb;

ods tagsets.excelxp options (sheet_name="less threshold count"
								embedded_titles="yes"
								sheet_interval="none");
proc freq data=diag;
tables patid/out= test list missing;
run;

data test2;
set test;
if count le 5 then count = .t ;
run;



ods tagsets.excelxp close;

The reason for getting output of "test2" is that i want to replace the count of population with T which has less than 10 count.

Thanks,

Jeetender

2 REPLIES 2
SuryaKiran
Meteorite | Level 14

What you print in the ODS destination will be in your result.

 

Change to this:

 

proc sort data=diagnosis out=diag;
by patid;
run;
proc freq data=diag;
tables patid/out= test list missing;
run;

data test2;
set test;
if count le 5 then count = .t ;
run;

ods tagsets.excelxp file="location of excel file\test.xml" style=sasweb;

ods tagsets.excelxp options (sheet_name="less threshold count"
								embedded_titles="yes"
								sheet_interval="none");
proc print data=test2 noobs;
run;

ods tagsets.excelxp close;
Thanks,
Suryakiran
jeetendersinghc
Fluorite | Level 6
Got it !!

Thanks,
Jeetender

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 499 views
  • 1 like
  • 2 in conversation