BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Amy0223
Quartz | Level 8

Hi, 

 I get a note below when running the format procedure. I'm not sure how to correct the codes. Any help is greatly appreciated!

NOTE: Format CONT is already on the library WORK.FORMATS.
NOTE: Format CONT has been output.
100 run;
 
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
Below are my codes.
data demog;
  input id contry $ 5-17 pop 19-22 pcturb 24-25 energy 27-29 cult 31-32 
        pasture 34-35 forest 37-38;
cards;
101 China         1062 32  19 11 30 14
107 Japan          122 76 111 13  2 68
113 Philippines     62 40   9 38  4 40
102 India          800 25   7 51  4 21
112 Vietnam         62 19   4 20  1 40
109 Bangladesh     107  .   .  .  .  .
105 Indonesia      175  .   .  .  .  .
110 Paskistan      105 28   6 25  6  4
304 United States  243 74 280 20 26 28
311 Mexico          82 70  50 13 38 23
406 Brazil         141 71  19  9 19 66
508 Nigeria        109 28   7 34 23 16
603 USSR           284 65 176 10 17 42
614 West Germany    61 85 163 30 19 29
615 Italy           57 72  90 41 16 21
;
run;


proc format;
value cont   100-199='Asia'        200-299='Australasia'
             300-399='N. America'  400-499='S. America'
             500-599='Africa'      600-699='Europe';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You probably don't need to do anything.  The message is just saying you are defining CONT, but CONT already existed. So the old definition will be replaced with the new definition.  You have probably submitted the same block of code more than once in the current SAS session.

 

It would only be a problem if you are trying to use the same format name to mean two different things at the same time.

View solution in original post

7 REPLIES 7
gamotte
Rhodochrosite | Level 12

Hello,

 

There is nothing to correct. This is a simple note that tells you that the format already exists

because of a previous execution of the program.

PeterClemmensen
Tourmaline | Level 20

The note just tells you that the format already exists in the location, but it is overwritten. There is nothing to correct here, your code looks fine.

Tom
Super User Tom
Super User

You probably don't need to do anything.  The message is just saying you are defining CONT, but CONT already existed. So the old definition will be replaced with the new definition.  You have probably submitted the same block of code more than once in the current SAS session.

 

It would only be a problem if you are trying to use the same format name to mean two different things at the same time.

Amy0223
Quartz | Level 8
Thank you so much! I greatly appreciate your help!
Amy0223
Quartz | Level 8

Thank you so much! I tried to answer this problem below using the data provided. But I got an error saying "Variable CONT not found." I'm not sure what I did wrong?

(Variable contry should be country. But it was given in the data by my instructor so I just assume that's correct)

 

A. Write chart procedure statements to produce a vertical bar chart of average energy consumption by country grouped into continent.
Use the cont format to recode country number into continent name. What would the chart look like if the format were not used?

 

proc chart data=demog;
vbar contry/group=cont
SUMVAR=energy type=mean;
run;
Tom
Super User Tom
Super User

What variable is being graphed?

Sounds like COUNTRY (how ever it is named) is the GROUP= variable.  You just want to use a FORMAT statement to tell it use the formatted values for the groups instead of the raw values.

.... group=country .... ;
format country cont. ;
Amy0223
Quartz | Level 8
Thank you for taking the time to help me. I will try it this way.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 2165 views
  • 3 likes
  • 4 in conversation