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!
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;
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.
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.
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.
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.
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;
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. ;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.