BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hari2
Quartz | Level 8

Hi All,

 

I have list of variables in final data set and I don't want to display one variable. But I am using that variable in Sorting, so I can not drop that variable. Lets assume that variable name as 'Height'. 

 

So,

- I kept the variable in Keep statement and I have sorted it.

- Now I am using ODS statement and then I used Proc Print as below.

 

ods listing close;
ods excel file=" ./abc.xls " ;
title "Review &study ABC";
run;


proc print data=FINAL label noobs ;
var XX YY ZZ ; /*Though I am not keeping the variable ('Height') in VAR statement, I am still getting that variable in final output Excel file*/
run;  

 

Please suggest how can I drop it (Height) from final Output file ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

@Hari2 wrote:
I tried it already and still I am getting the variable in Output Excel file.

Please post the full log.

View solution in original post

4 REPLIES 4
sustagens
Pyrite | Level 9

add it the drop statement after specifying the dataset name

proc print data=FINAL (drop=Height) label noobs;

 

Hari2
Quartz | Level 8
I tried it already and still I am getting the variable in Output Excel file.
andreas_lds
Jade | Level 19

@Hari2 wrote:
I tried it already and still I am getting the variable in Output Excel file.

Please post the full log.

Hari2
Quartz | Level 8
Hi , I was checking final dataset and it was there in that. I realized it now that we are removing in final Excel file as we are dropping in Proc Print, so it's working and I dont see it in the Output Excel file.

Thanks for your reply. 🙂

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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 4136 views
  • 0 likes
  • 3 in conversation