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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 10563 views
  • 2 likes
  • 3 in conversation