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

Hi Both,

 

thanks for replying

 

Yes, I understand that proc print demonstrate. ive also tried the suggestion already.

I tried the dataset2, however it just gives me the orginal dataset2 with the VAR1,2,3

 

1/07/2016 1 0 1
8/07/2016 0 1 1
15/07/2016 0 0 1

 

Just wanting to know what option can you suggest to output the modified datset2 with the new labels as a dataset rather than a sas report

 

Ksharp
Super User
If you need this table be used to join to another table ,
Then apply my code on your final dataset .not the temporary table.

SASuserxx
Calcite | Level 5

Hi Ksharp,

 

yes i have applied it and it works perfect.

just that when i open the dataset2, its not the modified version

 

i attached the file

Reeza
Super User

View your proc contents. 

Note that the LABEL is correct, but I'm suspecting you actually want to change the variable name, not the label. 

Does that sound correct?

 

 

Reeza
Super User

Datset2 doesn't have the labels after the proc datasets?

That doesn't seem correct, otherwise how can Proc print display it correctly?

SASuserxx
Calcite | Level 5

Hi Reeza,

 

 

Yes, i want the variables name changable when i upload the dataset1 again with different column names

 

sorry wasnt clear before

 

thanks

 

 

Reeza
Super User

Well the process is essentially the same. Modify the SQL query so there are no quotes in the macro variable. (Var1=apples vs var1="apples")

And then in proc datasets change the word label to rename. 

 

 

SASuserxx
Calcite | Level 5

Hi

 

i get this error, what does it mean?

 

ERROR 22-322: Expecting a name.

ERROR 201-322: The option is not recognized and will be ignored.

 

thanks

 

 

Reeza
Super User

@SASuserxx wrote:

Hi

 

i get this error, what does it mean?

 

ERROR 22-322: Expecting a name.

ERROR 201-322: The option is not recognized and will be ignored.

 

thanks

 

 


You did something incorrectly. 

 

Without seeing the code or rest of the log that's about all anyone can say. 

SASuserxx
Calcite | Level 5

Hi,

 

when i tried the modification advised  on the original problem, its works

 

then i modified to my real problem

 

proc sql noprint;

select cats(colname,'=',label,'') into : label separated by ' '

from dataset1;

quit;

proc datasets library=work nolist nodetails;

modify datset2;

rename &label ;

quit;

proc print data=datset2 noobs label;run;

data datset2_N;

set datset2;

run;

 

my code,

the proc print works and changes but the dataset doesnt change the same as the proc print data

proc sql noprint;

select cats(Variables,'=',Discription,' ') into : Discription separated by

from cfg.jp21vartable;

quit;

proc datasets library=in nolist nodetails;

modify jp21var;

rename &Discription;

quit;

proc print data=in.jp21var noobs label;

run;

data new;

set in.jp21var;

run;

 

Reeza
Super User

Look at the description macro variable and/or compare to solutions posted. It seems incorrect. Why is the third parameter a space? 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 26 replies
  • 1962 views
  • 2 likes
  • 3 in conversation