Date: Tue, 6 Oct 2009 13:29:39 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: I want to drop a specific variable with a specific value
In-Reply-To: <744ec0710910061036w60de5cf8n72f80b30fc75e6b2@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
That makes far, far less sense than transposing it via PROC FREQ and/or one
row per pair. You (still) cannot drop columns based on a set of data-driven
conditions, and now you have a bunch of datasets instead of one.
-Joe
On Tue, Oct 6, 2009 at 12:36 PM, Theresa Roman <troman.sas@gmail.com> wrote:
> Thank you all for your input.
>
> That makes sense...so what if I tell you that I can split the file in a way
> that I get a single observation, i.e. a single row.
> How can i ask SAS to let me keep only those variables for which Qi is in
> (2,3) and Qis =' ' ?
>
> So i run this code:
>
> data check;
> set form1;
> If (Q13 in (2,3) and Q13s=' ') or (Q14 in (2,3) and Q14s=' ') or (Q15 in
> (2,3) and Q15s=' ') or (Q16 in (2,3) and Q16s=' ') or (Q17 in (2,3) and
> Q17s=' ') or (Q18 in (2,3) and Q18s=' ');
> run;
>
> then I have already set up a macro that splits the above data set check by
> observation. So if the above set has 5 observations with this split macro i
> get five different data sets.
>
> This new five data sets still contain 3 variables UNIQUE ID, Q13-Q18 and
> Q13s-Q18s. Now, how do I ask SAS to get rid off those variables for which
> qi
> is not in (2,3) and Q1s =blank.
>
> and I want to drop both Qi and Qis if this is true. So the final set will
> be
> a single obs (single row) with variables where Qi is in (2,3) and Qis is
> blank.
>
> I tried an array but I can't get it to work.
>
> Any suggestions?
>
>
>
> On Tue, Oct 6, 2009 at 12:36 PM, Theresa Roman <troman.sas@gmail.com>
> wrote:
>
> > Hello,
> >
> > Any suggestions will be greatly appreciated.
> >
> >
> > Nature of the dataset: 13 variables UNIQUE ID, Q13-Q18 and Q13s-Q18s
> >
> > Goal: logic check.
> >
> > Possible values of Q12-Q18 are 1, 2, or 3.
> > Q13s-Q18s are character variables
> >
> > Here is what i have so far:
> >
> > data check;
> > set form1;
> > If (Q13 in (2,3) and Q13s=' ') or (Q14 in (2,3) and Q14s=' ') or (Q15 in
> > (2,3) and Q15s=' ') or (Q16 in (2,3) and Q16s=' ') or (Q17 in (2,3) and
> > Q17s=' ') or (Q18 in (2,3) and Q18s=' ');
> > run;
> >
> >
> > so basically if q13 is 2 or 3, Q13s can't be left blank same idea with
> > Q14-Q18.
> >
> > So I want data set "check' to have only those variables where this is the
> > case.
> > However, using the code above, I am getting all 12 variables again. So if
> > at least for one question from Q13-Q18 this is true I get all the
> variables.
> > Does that make sense?
> >
> > I don't want that. I only want the variables where Qi is in 2,3 and Qis
> is
> > blank to show, nothing else. where i is 13 to 18.
> >
> > Any suggestions?
> >
> > Thanks,
> >
> > Tere
> >
>
|