BookmarkSubscribeRSS Feed
robertrao
Quartz | Level 8

Hi,

I was trying to apply formats on a charecter variable and it gives a WARNING:

"VARIBALE HAS ALREADY BEEN DEFINED NUMERIC"????

I used like below

description=put(code,$format.);

Could you suggest me where i went wrong????

4 REPLIES 4
art297
Opal | Level 21

I would guess that you are trying to apply a character format to a numeric variable.  Possibly the following examples will help:

proc format;

  value $charformat

'1'='yes'

'2'='no';

  value numformat

1='yes'

2='no';

run;

data test;

  input charcode $ numcode;

  chardescription=put(charcode,$charformat.);

  numdescription=put(numcode,numformat.);

  cards;

1 1

2 2

;

robertrao
Quartz | Level 8

Hi Art,

Thanks for the reply.. Thats a charecter variable

Reeza
Super User

Do you have a variable called description already in the dataset?

Tom
Super User Tom
Super User

Your variable CODE is numeric and you are trying apply a character format (notice the leading dollar sign) to it.

229   proc format;

229 !              value $format '8'='eight';

NOTE: Format $FORMAT has been output.

229 !                                         run;

230   data x;

231    code=8 ;

232    description=put(code,$format.);

                            --------

                            484

WARNING: Variable code has already been defined as numeric.

NOTE 484-185: Format FORMAT was not found or could not be loaded.

233   run;

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!

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
  • 4 replies
  • 2228 views
  • 0 likes
  • 4 in conversation