Date: Mon, 17 May 2004 10:36:19 -0400
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Re: Overriding SAS keywords on an input control dataset
On Mon, 17 May 2004 10:19:59 -0400, Nancy Brucken <brucken@PROVIDE.NET>
wrote:
>Hi all,
> I am trying to build an informat in a format catalog using an input
>control dataset. However, one of the start values is 'Other', which SAS
>keeps interpreting as the [OTHER] keyword in an INVALUE statement, and
>turning into ** OTHER ** in the informat, causing all of the blank values
>in my data that are read in using that informat to be assigned a value of
>99, rather than left blank.
> My input control dataset looks like:
>
>FMTNAME START END LABEL TYPE
>NY Yes Yes 1 I
>NY No No 0 I
>NY Other Other 99 I
>
>Is there a way I can get SAS to leave 'Other' as a text string, rather
than
>turning it into a keyword? I tried putting quotes around its value in the
>input control dataset, but SAS still made it a keyword. My current
>workaround is to just create the format manually with a PROC FORMAT
INVALUE
>statement, but this is a long-term project involving many datasets and
>informats, and I'd prefer not to go the manual route if I don't have to.
>
>Thank you very much for any help you can provide,
Hi, Nancy,
Clear the variable HLO. For example, the following makes an informat that
takes "Other" as any other string value. HTH.
Cheers,
Chang
data ny;
retain fmtname "ny" type "J"; /* string informat is type="J" */
start = "Yes"; label=1; output;
start = "No"; label=0; output;
start = "Other"; label=99; hlo=""; output;
run;
proc format cntlin=ny;
run;
data _null_;
length val $5;
do val = "Yes", "No", "Other";
frmVal = input(val, ny.);
put val= frmVal=;
end;
run;
/* on log
val=Yes frmVal=1
val=No frmVal=0
val=Other frmVal=99
*/
|