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 (April 2001, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 17 Apr 2001 17:10:26 -0500
Reply-To:   Jamil Ibrahim <jibrahim@IR.UMSMED.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jamil Ibrahim <jibrahim@IR.UMSMED.EDU>
Subject:   WHAT IS WRONG WITH CODE
Comments:   To: SAS-L@UGA.CC.UGA.EDU
Content-Type:   multipart/alternative;

I WANT THIS CODE TO START A NEW LINE EVERY TIME IT SEES AN * options nodate nonumber SYMBOLGEN; dm "log;clear;out;clear";

DATA DESCA;*** FIRST 18 QUESTIONS - GENERAL OBJECTIVES; INFILE 'c:\SASDATA\MLINE.DAT' lrecl=200 MISSOVER pad ; INPUT @1 dat $char200. ; array x(*) z1-z200; p=0; COUNT=0; do i=1 to 200;p+1; if substr(dat,p,1)="*" then do; COUNT+1;IF COUNT=1 THEN DO;P1=P;END; IF COUNT=2 THEN DO;P2=P;END;

end; END;

if COUNT=0 THEN do; DESC1=DAT; DESC2=" "; DESC3=" "; END;

if COUNT=1 THEN do; desc1=SUBSTR(DAT,1,P1-1); POS2=P1+1;left=200-P1; DESC2=SUBSTR(DAT,POS2,left); DESC3=" "; END;

If COUNT=2 THEN do; desc1=SUBSTR(DAT,1,P1-1); POS2=P1+1; RANGE=P2-POS2; DESC2=SUBSTR(DAT,POS2,RANGE);left=200-(P2+1); DESC3=SUBSTR(DAT,P2+1,LEFT); END;

output; RUN;

DATA DESCB; SET DESCA; FILE 'C:\SASDATA\MLINE2.DAT'; PUT @1 DESC1 $CHAR200. / @1 DESC2 $CHAR200. / @1 DESC3 $CHAR200. ;

*********************** THE INFILE FILE IS :

Line1*ABCD2*FGHI4 ggggggggggggggggggggg*mmmmmmmmmm vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

THE OUTPUT FILE LOOKS LIKE THIS:

Line1 AB FGH ggggggggggggggggggggg mm vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Dr. Jamil Ibrahim, Ph.D. Institutional Research Associate Assistant Professor , SHRP Univ. Of Miss. Med. CTR. 2500 N state St Jackson, MS 39216 Tel. 601-984-1197 Fax 601-984-1205


[text/html]


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