BookmarkSubscribeRSS Feed
gsk
Obsidian | Level 7 gsk
Obsidian | Level 7

For instance, after a variable, we can put label = '~' to label a variable. Can we label variables with * instead of typing out all the variables and putting label = ' ~~ '  next to each?

 

PROC SQL;
Title 'a) All Rows and Columns Without Labels';
   SELECT *   <- After putting SELECT * instead of listing all the variables: is there an easier way to label each variable? 
   FROM directory.dataset;

QUIT; 

2 REPLIES 2
Reeza
Super User

No, I don’t think you can, for starters how would the compiler know which variables to label. 

 

If you have a data set with the mapping of variables to labels you can do an automated labelling process. 

 

If you’re using * because you’re too lazy to list them all, a perfectly valid reason, use the FEEDBACK option in the PROC SQL statement and check the log. It will have the full code with appropriate alias and you can modify it as necessary. 

 

You can also add labels after the fact using PROC DATASETS. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, you can't label variables when selecting all.  Its rarely a good idea to use the * anyways, it can cause issues, and will definately make you sql take longer to run and use more disk space.  I would always use explicit definitions of what you want to select, from where, and what specific data, not only does this make the code nice an transparent, but as quick as it can be.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1654 views
  • 3 likes
  • 3 in conversation