Yes, Art -- I caught my mistake and was able to specify the data step
correctly, as shown below:
*data have;*
* set Cwn_stud.Shinno;*
*run;*
------------------------------------------------------------------
On Sun, Nov 15, 2009 at 12:34 AM, Arthur Tabachneck <art297@netscape.net>wrote:
> Chao,
>
> You confused SAS. You started off with the word 'data', which tells
> SAS that you are starting a data step.
>
> However, you didn't end the line with a semi-colon, or include any
> data step code but, rather, thought you were telling it to run proc
> sql which it wouldn't know as it was looking for data step code.
>
> Art
> -----------
> On Nov 14, 11:16 pm, Yawo1...@YAHOO.COM (Chao Yawo) wrote:
> > Thanks to you both for your responses. I tried the sample code and got
> this
> > error.
> >
> > ------------------------------------------------------------------------
> > *85 data Cwn_stud.Egonet_shinn_data*
> > *86 proc sql;*
> > *87 select distinct respid into :colnm separated by ' '*
> > * --------*
> > * 395*
> > * 76*
> > *ERROR 395-185: Opening parenthesis for SELECT/WHEN expression is
> missing.*
> > *
> > *
> > *ERROR 76-322: Syntax error, statement will be ignored.*
> > *
> > *
> > *88 from Egonet_shinn_data;*
> > *-----------------------------------------------------------------------*
> > *
> > *
> > I believe it may have something to do with my data step or the way I am
> > referring to the data. I am trying to figure it out, and would be very
> > grateful for any additional input/assistance.
> >
> > thanks very much -- Cy
> >
> > I think it may have to do with
> > ------------------------------------------------------------------
> >
> >
> >
> > On Tue, Oct 27, 2009 at 2:22 AM, gupt <pvsgu...@gmail.com> wrote:
> > > On Oct 26, 11:31 pm, ya.hu...@AMYLIN.COM (Ya Huang) wrote:
> > > > Here is one:
> >
> > > > data xx;
> > > > input ClassA $ OtherStud $ WorkWith;
> > > > cards;
> > > > AA DD 1
> > > > AA EE 0
> > > > AA BB 1
> > > > BB FF 1
> > > > BB GG 1
> > > > BB KK 0
> > > > CC AA 1
> > > > CC BB 1
> > > > ;
> >
> > > > proc sql;
> > > > select distinct classa into :colnm separated by ' '
> > > > from xx;
> >
> > > > data yy;
> > > > array col &colnm;
> > > > do until(last.classa);
> > > > set xx;
> > > > by classa;
> > > > do over col;
> > > > if otherstud=vname(col) and workwith=1 then col=1;
> > > > end;
> > > > do over col;
> > > > if col=. then col=0;
> > > > end;
> > > > end;
> > > > run;
> >
> > > > proc print;
> > > > var classa &colnm;
> > > > run;
> >
> > > > Class
> > > > Obs A AA BB CC
> >
> > > > 1 AA 0 1 0
> > > > 2 BB 0 0 0
> > > > 3 CC 1 1 0
> >
> > > > On Mon, 26 Oct 2009 09:41:45 -0400, Chao Yawo <Yawo1...@YAHOO.COM>
> > > wrote:
> > > > >Hi,
> >
> > > > >I have a dataset with the following structure.
> >
> > > > >ColumnA ColumnB ColumnC
> > > > >ClassA OtherStud WorkWith
> >
> > > > >AA DD 1
> > > > >AA EE 0
> > > > >AA BB 1
> > > > >BB FF 1
> > > > >BB GG 1
> > > > >BB KK 0
> > > > >CC AA 1
> > > > >CC BB 1
> >
> > > > >ColumnA refers to students in ClassroomA, and Column B refers to
> "Other
> > > > >Students" in the school who could act as work and/or playmates.
> >
> > > > >Note, ColumnB could also include some of the same students in
> > > > >ColumnA(ClassA) who work with each other (For example, Students: AA
> > > > >and BB).
> >
> > > > >If a Student in Classroom A works with a student in ClassroomB,
> ColumnC
> > > > >takes the value of 1, and 0(zero) if otherwise
> >
> > > > >So, looking at ColumnA, we find that there are three students: AA,
> BB
> > > and
> > > > >CC. Student_AA for instance interacts with three students <DD, EE,
> BB>
> > > but
> > > > only
> > > > >works with DD and BB. Similarly, Student_CC interacts with two
> students
> > > > ><AA, and BB> and works and plays with each of them.
> >
> > > > >Now, I am interested in constructing a matrix indicating which
> > > > >students in ClassroomA work with each other. This means
> > > > >that student_AA for instance works with student_BB, who is in
> his/her
> > > > >classroom, hence the cell in their matrix will have a "1".
> >
> > > > >Again, Student_CC in ClassroomA works with 2 other members of
> > > > >his/her own class<ie, AA and BB>. So CC would have two "1s" in the
> > > matrix.
> >
> > > > >The resulting matrix for the "Works With" relation (ColumnC) among
> the 3
> > > > >students in ClassroomA would look like this.
> >
> > > > > AA BB CC
> > > > >AA 0 1 0
> > > > >BB 0 0 0
> > > > >CC 1 1 0
> >
> > > > >This matrix is the output I am interested in, and need to produce
> for
> > > > >the relationship specified in Column C.
> >
> > > > >I would certainly appreciate some ideas to help me produce this.
> >
> > > > >Thanks in advance for your assistance.
> >
> > > > >Sincerely, Cy
> >
> > > > >------------------------------------------------------------------
> >
> > > HI, the above code is quiet interesting dude. I came to know that "do
> > > over" is a key word in SAS.
> > > Thank you for your help.- Hide quoted text -
> >
> > - Show quoted text -
>
|