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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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