Date: Fri, 24 Sep 2010 10:52:53 -0400
Reply-To: Dave Brewer <david.brewer@UC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dave Brewer <david.brewer@UC.EDU>
Subject: Re: PROC FORMAT Anomaly
Joe,
Excellent explanation...thanks so much.
Dave
On Fri, 24 Sep 2010 08:32:24 -0500, Joe Matise <snoopy369@GMAIL.COM> wrote:
>I believe that PROC FREQ etc. will not show [whatever Missing is formatted
>as] without having the /MISSING option, to allow you to do things like
code
>missing to "MISSING" or whatnot, or to (say) code an 8 as missing in a 1-5
>scale where 8,9 are DK/REF. Add the /MISSING option and you'll see that
>'Invalid' is indeed being used - just not displayed. Since * and n/f N
are
>being formatted to the same code as ' ', they are considered missing for
the
>purposes of the PROC FREQ.
>
>-Joe
>
>On Fri, Sep 24, 2010 at 8:15 AM, Dave Brewer <david.brewer@uc.edu> wrote:
>
>> I am having a problem trying to figure out why my user-defined format is
>> not working as expected.
>>
>>
>> proc format ;
>> value $class
>> 'AA000'-'ZZ999' = 'Valid'
>> OTHER = 'Invalid'
>> /* ' ' = 'Missing'*/
>> ;
>> run;
>> data x;
>> INFORMAT CLASS $5.;
>> input class $;
>> cards;
>> TN555
>> XX666
>> AA123
>> *
>> n/f N
>> .
>> .
>> .
>> ;
>> run;
>>
>> proc freq data=x;
>> tables class;
>> format class $class.;
>> run;
>>
>> I would expect the freq to show 2 Invalid, 3 Valid and 3 missing. When I
>> run the PROC FORMAT as noted above, I get 3 Valid and 5 missing;
uncomment
>> the line and I get the expected results.
>>
>> Can someone explain why this is? Also, how do I code my FORMAT statement
>> to have code the missing as invalid or some other verbage?
>>
>> Thanks.
>> Dave
>>
|