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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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