03-11-2014 08:59 PM
I am running some simple descriptives for a rather large dataset.
I'll use the variable 'Q54' as an example.
Running a simple Proc Freq procedure for 'Q54'.
Q54 has 5 response options noted in the excel file as 1, 2, 3, 4, and 5.
I want to rename 1, 2, 3, 4, and 5 as satisfied, somewhat satisfied, neutral, somewhat dissatisfied, and dissatisfied, respectively.
When writing code for this using :
I get an error term stating:
792 value q69
ERROR: The format name Q69 ends in a number, which is invalid.
Any insight as to the best way to remedy this issue?
Thanks for looking over my issue and appreciate any help.
03-11-2014 09:33 PM
SAS numeric format names must start with a letter and end with a letter. So if Q54 is numeric, you could use:
1 = 'Satisfied'
2 = 'somewhat satisfied'
3 = 'neutral'
4 = 'somewhat dissatisfied'
5 = 'dissatisfied';
Note the absence of quotes around the numbers. Otherwise, if Q54 is a character variable, you need to define a character format such as:
'1' = 'Satisfied'
'2' = 'somewhat satisfied'
'3' = 'neutral'
'4' = 'somewhat dissatisfied'
'5' = 'dissatisfied';
Note the dollar sign before the format name.
03-11-2014 09:33 PM
I'd really hope sas would eventually change that limitation but, currently, the formats can't end in a number.
However, your asking about q54, but tried to call the format q69. Was that an error in your thought process?
03-12-2014 12:57 AM
The reason SAS format names do not end with a numeral is that the numeral at the end of the name would be interpreted as a width definition. Thus the format use q1234. would mean use the format q and assign 1234 spaces to the display.
It would not be impossible to modify the SAS interpreter to check first to see if q1234 was a valid format but this could result in potential ambiguity. Now that the limit has been relaxed on the length of format names it is not too much of a hardship to append one or more alpha characters so that the name does not end in a numeral. My vote would be for the status quo.