LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Aug 2006 08:39:13 -0700
Reply-To:     Arjen <a.benedictus@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arjen <a.benedictus@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Putting new observations on new rows
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset="iso-8859-1"

Hello,

/* I have a table "Table1": */ Data Table1; retain v1 v2 v3 expl; length expl $255; input v1 $ v2 $ v3 $ expl $; cards; p p . Story1 p n y Story2 p n n Story3 p u . Story4 n p . Story5 n n . Story6 n u . Story7 ; run; proc print data=matrix; run;

/*I am trying to convert Table1 according to the following requirements: 1. All rows should be read from left to right. If an observation is the first in a COLUMN, a NEW ROW should be put into a new table with only this observation in it. 2. If an observation is empty, an empty line should be inserted into the table. 3. If an observation is not the first, no row should be inserted.

I tried the first step: inserting a new row for every first observation. But my code is not working. Can anybody tell me how to adjust it? Thanks so much. Arjen */

%let numblanks = 1 ; data outline1 ( drop = __i ) ; set table1; by v1 v2 v3 notsorted; array allcha _character_ ; array VV v1-v3; output; do index = 1 to 3; if first.VV{index} then do __i = 1 to &numblanks. ; do over allcha ; allcha = " " ; end; output; end; end; run; proc print data=outline1; run;


Back to: Top of message | Previous page | Main SAS-L page