Help using Base SAS procedures

why do i have such warning message?

Reply
Frequent Contributor
Posts: 89

why do i have such warning message?

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.
Super Contributor
Super Contributor
Posts: 3,174

Re: why do i have such warning message?

Posted in reply to littlestone
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
Super User
Posts: 10,044

Re: why do i have such warning message?

Posted in reply to littlestone
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
Frequent Contributor
Posts: 89

Re: why do i have such warning message?

Posted in reply to littlestone
sorry for the late response.

Thank you all for help.
Ask a Question
Discussion stats
  • 3 replies
  • 6075 views
  • 2 likes
  • 3 in conversation