Date: Wed, 16 Apr 2008 11:01:39 -0700
Reply-To: jamesgreen55@YAHOO.CA
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jamesgreen55@YAHOO.CA
Organization: http://groups.google.com
Subject: Re: Problem
Content-Type: text/plain; charset=ISO-8859-1
On Apr 16, 1:37 pm, salim <abhinandangosw...@gmail.com> wrote:
> Hi Guys , I was facing a peculiar problem while writing the sas
> datafile.
>
> consider the following statements
>
> @1 data1 $char10.
> @12 data2 $char19.
> @70 'C'
> @;
> IF PP1 = 'Y' THEN DO;
> @101 DATA3 $CHAR10.
> @;
> END;
> IF PP2 = 'Y' THEN DO;
> @153 DATA3 $CHAR10.
> @;
> END;
> IF PP3 = 'Y' THEN DO;
> @201 DATA3 $CHAR10.
> ;
> END;
>
> NOW ONLY THOSE RECORDS WERE WRITTEN FROM THE INCOMING DATASET WHICH
> HAD ALL THE VARIABLE PP1,PP2,PP3 CONDITION SATISFIED.
>
> REST WERE JUST NOT WRITTEN.
>
> WHAT CAN BE A POSSIBLE REASON FOR THIS ????
So far as I know it is because you did not ask SAS to process/output
them, you've listed three conditions that when met, will be output but
you did not tell SAS what to do when the conditions are not met...
You need to add more if statements (or Else).. not sure what you wnat
to do with them but something along the lines of
IF PP1 = 'Y'
THEN DO;
@101 DATA3 $CHAR10.
@;
ELSE do something here!
END;
IF PP2 = 'Y'
THEN DO;
@153 DATA3 $CHAR10.
@;
ELSE do something here!
END;
IF PP3 = 'Y'
THEN DO;
@201 DATA3 $CHAR10.
@;
ELSE do something here!
END;
Add any othe applicable statements...
HTH ? James