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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 598 views
  • 1 like
  • 2 in conversation