BookmarkSubscribeRSS Feed
mono_libre
Calcite | Level 5
Hello!

I want to create a variable called:
_111_dataset.

Please advise, can I do somethink like:
%let id=_111_;
%let &id.dataset = work.main_data;
2 REPLIES 2
DanielSantos
Barite | Level 11

Hi.

 

Well it's possible and it does work.

 

%let id=_111_;
%let &id.dataset = work.main_data;

%put &_111_dataset;
%put &&&id.dataset;

But unless you want that ID to be variable there is no need to do that.

 

Daniel Santos @ www.cgd.pt

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Why?  How do you see _111_work.dataset being a useful variable name - remembering that if you do so you can't use any of the short hand methods like: var:

Remember SAS provides to parts to varaibles - the name which is used in programming and should be succient and simple to program with as this is the main purpose of it, and the label which can be pretty much anything and is for people to look at and understand.  

I can pretty much guarentee any code you write from the point you describe there is going to be messy and over complicated.

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!

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.

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
  • 652 views
  • 1 like
  • 3 in conversation