BookmarkSubscribeRSS Feed
littlestone
Fluorite | Level 6
dear all, here is my code:


data test;
input SS;
cards;
123456789
234567891
;
run;

data test;
set test (rename=(SS=ID));
SS=put(ID,$9.);
drop ID;
run;


After running the code, I got following message in the log:


566 SS=put(ID,$9.);
WARNING: Variable ID has already been defined as numeric.
567 drop ID;


The strange thing is: if I change the code:

SS=put(ID,$9.);

to:

SS=put(ID,ssn11.);


There is no any warning message.

Can anyone clarify why is the warning message? Thanks.
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Your SAS variable ID is defined as a SAS NUMERIC type variable while you are attempting to use a SAS CHARACTER type format (it has the leading "$" character prefix in the name).

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

variable has already been defined as numeric site:sas.com
Ksharp
Super User
Just as Scott said. Your id is numeric variable and your $9. is character format ,So they are not matched.
So try to
[pre]


data test;
input SS;
cards;
123456789
234567891
;
run;

data test;
set test (rename=(SS=ID));
SS=put(ID,9.);
drop ID;
run;
[pre]

Ksharp
littlestone
Fluorite | Level 6
sorry for the late response.

Thank you all for help.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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