Date: Fri, 25 Jun 2004 12:47:12 -0700
Reply-To: "Terjeson, Mark" <TERJEM@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <TERJEM@DSHS.WA.GOV>
Subject: Re: What is wrong with this code ?
Content-Type: text/plain; charset=iso-8859-1
Hi Rune,
Your if index(_infile,'---------') then output;
line is missing the trailing underscore:
if index(_infile_,'---------') then output;
Hope this is helpful,
Mark Terjeson
Reporting, Analysis, and Procurement Section
Information Services Division
Department of Social and Health Services
State of Washington
360.725.1598 voice
360.725.0615 fax
mailto:terjem@dshs.wa.gov
-----Original Message-----
From: Rune Runnestoe [mailto:rune@FASTLANE.NO]
Sent: Friday, June 25, 2004 12:24 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: What is wrong with this code ?
when running the code under, I get an empty dataset TEST. And there is
no red
error messages in the log to tell med why it doesn't work.
Can anyone see what is wrong ?
Regards
Rune Runnestø
data test;
infile cards;
attrib saksnr length=$12
arkiv length=$21
tittel length=$80
saksdato length=4 format=date.
siste_dok length=4 format=date.
ant_dok length=3
sansv length=$12
doknr length=3
javd length=$8
sbh length=$12
jdato length=4 format=date.
uoff length=$6
avs_mot length=$6
dok_tittel length=$50
avskr_doknr length=$5
dato length=4 format=date.
avskr_maate length=$1
;
retain saksnr ''
arkiv ''
tittel ''
saksdato .
siste_dok .
ant_dok .
sansv ''
doknr .
javd ''
sbh ''
jdato .
uoff ''
avs_mot ''
dok_tittel ''
avskr_doknr ''
dato .
avskr_maate ''
;
input;
if index(_infile,'---------') then output;
*For hvert felt må man starte å lese x antall tegn etter at tegnet
starter:;
if index(_infile_,'SAKSNR.:') then
saksnr=substr(_infile_,index(_infile_,'SAKSNR.:')+9);*x=9, se over;
if index(_infile_,'ARKIV:') then
saksnr=substr(_infile_,index(_infile_,'ARKIV:')+7);
if index(_infile_,'TITTEL:') then
tittel=substr(_infile_,index(_infile_,'TITTEL:')+9);
if index(_infile_,'SAKSDATO:') then
saksdato=substr(_infile_,index(_infile_,'SAKSDATO:')+11);
if index(_infile_,'SISTE DOK:') then
siste_dok=substr(_infile_,index(_infile_,'SISTE DOK.:')+12);
if index(_infile_,'ANT.DOK:') then
ant_dok=substr(_infile_,index(_infile_,'ANT.DOK:')+9);
if index(_infile_,'SANSV.:') then
sanv=substr(_infile_,index(_infile_,'SANSV.:')+8);
if index(_infile_,'DOKNR.:') then
doknr=substr(_infile_,index(_infile_,'DOKNR.:')+8);
if index(_infile_,'JAVD:') then
javd=substr(_infile_,index(_infile_,'JAVD:')+6);
if index(_infile_,'SBH:') then
sbh=substr(_infile_,index(_infile_,'SBH:')+5);
if index(_infile_,'JDATO:') then
jdato=substr(_infile_,index(_infile_,'JDATO:')+7);
if index(_infile_,'UOFF') then
uoff=substr(_infile_,index(_infile_,'UOFF')+6);
if index(_infile_,'AVS/MOT:') then
avs_mot=substr(_infile_,index(_infile_,'AVS/MOT:')+9);
if index(_infile_,'DOK.TITTEL:') then
dok_tittel=substr(_infile_,index(_infile_,'DOK.TITTEL:')+12);
if index(_infile_,'AVSKR.DOKNR.:') then
avskr_doknr=substr(_infile_,index(_infile_,'AVSKR.DOKNR.:')+14);
if index(_infile_,'DATO:') then
dato=substr(_infile_,index(_infile_,'DATO:')+6);
if index(_infile_,'AVSKR. MÅTE:') then
saksnr=substr(_infile_,index(_infile_,'AVSKR. MÅTE:')+13);
cards;
----------------------------------------------------------------------------
-------------------
SAKSNR.: 1991/1
ARKIV: RAPPORTARKIV
TITTEL: GEOLOGICAL COMLETION REPORT PL 098 WELL 7120/10-2 NOVEMBER
1990
SAKSDATO: 02.01.1991 SISTE DOK.: 02.01.1991 ANT.DOK: 1
SANSV.: OD/ODH/KT
DOKNR.: 1 JAVD: ODJ SBH: OD/ODH/K
JDATO:02.01.1991 UOFF 5 A
AVS/MOT: ESSO
DOK.TITTEL: GEOLOGICAL COMLETION REPORT PL 098 WELL 7120/10-2
AVSKR.DOKNR.: DATO: 02.01.1991
AVSKR. MÅTE: X
----------------------------------------------------------------------------
-------------------
SAKSNR.: 1991/2
ARKIV: RAPORTARKIV NR 9
TITTEL: RESERVOARTEKNISK RAPPORT STATFJORD NORD 1 EKS
SAKSDATO: 02.01.1991 SISTE DOK.: 02.01.1991 ANT.DOK: 1
SANSV.: OD/ODH/RO
DOKNR.: 1 JAVD: ODJ SBH: OD/ODH/R
JDATO:02.01.1991 UOFF FORTR
AVS/MOT: OD-S
DOK.TITTEL: RESERVOARTEKNISK RAPPORT STATFJORD NORD 1 EKS
AVSKR.DOKNR.: DATO: 02.01.1991
AVSKR. MÅTE: X
----------------------------------------------------------------------------
-------------------
run;
|