BookmarkSubscribeRSS Feed
raj143
Calcite | Level 5

i created two variables like var1 and var2.

%let var1=10;

%let var2=raju;

how to create dataset from these two variables with titled dataset name as "age_name" .???

thanks inadvance.....

5 REPLIES 5
ballardw
Super User

@raj143 wrote:

i created two variables like var1 and var2.

%let var1=10;

%let var2=raju;

how to create dataset from these two variables with titled dataset name as "age_name" .???

thanks inadvance.....


Why must a macro be involved? IF you are actually creating the macro variables with %let statements you are just adding work.

 

Data age_name;

   var1=10;

   var2 ='raju';

run;

would do it.

If the macro variable come from another process then YOU must know what type of value the data step variable would have to be and the result would look like:

 

Data age_name;

   var1 = &var1.;

   var2 = "&var2.";

run;

 

note that for macro text to resolve properly the values must be in double quotes, "   ", not single quotes, '   '.

 

Astounding
PROC Star

If you are asking how to create a data set named 10_raju, you should modify your plan.  That's not a legal data set name.

Reeza
Super User

There's not enough information in your initial post but I'm going to make a wild guess that you're looking for this:

 

https://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/

 


@raj143 wrote:

i created two variables like var1 and var2.

%let var1=10;

%let var2=raju;

how to create dataset from these two variables with titled dataset name as "age_name" .???

thanks inadvance.....


 

mnjtrana
Pyrite | Level 9
Hi @raj143,

As others pointed out, the problem is not much clear.

Can you provide more info.

Thanks,
Manjeet

Cheers from India!

Manjeet
Patrick
Opal | Level 21

@raj143 wrote:

i created two variables like var1 and var2.

%let var1=10;

%let var2=raju;

how to create dataset from these two variables with titled dataset name as "age_name" .???

thanks inadvance.....


@raj143 This is not twitter here so you've got actually ample space to formulate your problem and to even provide sample data....

 

Guessing what you're asking for:

%let var1=10;
%let var2=raju;

data &var2._&var1.;
  set sashelp.class;
run;

 

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
  • 5 replies
  • 610 views
  • 4 likes
  • 6 in conversation