Wow. thank you. That changes kind of did the trick. The output now has 112514 observations but it still doesn't read the whole thing. Why is that?
Thank you
363 data have;
364 infile 'C:\temp.csv' delimiter = ','
364! MISSOVER DSD lrecl=32767 firstobs=2 ;
365 length temp $ 8000;
366 retain temp;
367 input ;
368 if _n_ <= 20 then list ;
369 temp=cats(temp,_infile_);
370 if COUNTW(temp,',','mq') >= 14 then do;
371 var1=scan(temp,1,',');
372 var2=scan(temp,2,',');
373 var3=scan(temp,3,',');
374 var4=scan(temp,4,',');
375 var5=scan(temp,5,',');
376 var6=scan(temp,6,',');
377 var7=scan(temp,7,',');
378 var8=scan(temp,8,',');
379 var9=scan(temp,9,',');
380 var10=scan(temp,10,',');
381 var11=scan(temp,11,',');
382 var12=scan(temp,12,',');
383 var13=scan(temp,13,',');
384 /*
385 var3=.......
386 var4=.....
387 */
388
389 output;
390 call missing(temp);
391 end;
392 run;
NOTE: The infile 'C:\temp.csv' is:
Filename=C:\temp.csv.csv,
RECFM=V,LRECL=32767,File Size (bytes)=69042694,
Last Modified=27Jul2018:10:15:14,
Create Time=27Jul2018:10:15:01
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+
2 "282","10000S","Mr.","Donald","Mundle","","I","No","No","PO Box 183","Pugwash","NS","
86 B0K 1L0","CA" 98
3 "283","10001S","Mr.","Florence","Raney","","I","No","No","RR 1","Lower L'ardoise","NS
86 ","B0E 1W0","CA" 101
4 "284","10002S","Miss","Kaye","Martin","","I","No","No","PO Box 166","Whycocomagh","NS
86 ","B0E 3M0","CA" 101
5 "285","10003S","Mr.","Grant","Goodine","","I","No","No","PO Box 670","Bridgetown","NS
86 ","B0S 1C0","CA" 101
6 "286","10004S","Mrs.","Myrtle","Macumber","","I","No","No","RR 1","Walton","NS","B0N
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+
86 2R0","CA" 94
7 "287","10005S","Ms.","Daisy","MacPhee","","I","No","No","PO Box 28","Shubenacadie","N
86 S","B0N 2H0","CA" 102
8 "288","10006S","Mrs.","Joyce","Guild","","I","No","No","Jeffery Street","Bridgetown",
86 "NS","B0S 1C0","CA" 104
9 "289","10008S","Mr.","Basil","Lenihan","","I","No","No","200 Forties Rd 71
10 PO Box 128","New Ross","NS","B0J 2M0","CA" 42
11 "290","10009S","Mr.","George","Melanson","","I","No","Yes","7093 Hwy 101","Plympton",
86 "NS","B0W 2R0","CA" 104
12 "291","1000S","Mr.","Gregory","Dugas","","I","No","No","General Delivery","Alder Poin
86 t","NS","B0C 1A0","CA" 107
13 "292","10010S","Mr.","Kenneth","d'Entremont","","I","No","No","PO Box 127","Lowere We
86 st Pubnico","NS","B0W 2C0","CA" 116
14 "293","10011S","","","","Weymouth Drug Store Ltd.","O","No","No","PO Box 119","Weymou
86 th","NS","B0W 3T0","CA" 108
15 "295","10012S","Mrs.","Lydia","Brewer","","I","No","No","PO Box 688","Bridgetown","NS
86 ","B0S 1C0","CA" 101
16 "296","10013S","Mrs.","Gladys","McLaughlin","","I","No","No","Centennial Apt.21, Bo",
86 "Bridgetown","NS","B0S 1C0","CA" 117
17 "297","10014S","Ms.","Jane","Wightman","","I","No","No","64 Granville St W","Bridgeto
86 wn","NS","B0S 1C0","CA" 108
18 "298","10016S","Ms.","Anna","MacCarthy","","I","No","No","PO Box 1006","Windsor","NS"
86 ,"B0N 2T0","CA" 100
19 "299","10017S","Ms.","Kathleen","Barr","","I","No","No","RR 2","Weymouth","NS","B0W 3
86 T0","CA" 93
20 "300","10019S","Mrs.","Elizabeth","Gordon","","I","No","No","RR 1 Po","Milford Statio
86 n","NS","B0N 1Y0","CA" 107
21 "301","1001S","Mrs.","Wong","Lee","","I","No","No","6264 North Street","Halifax","NS"
86 ,"B3L 1P5","CA" 100
NOTE: 654273 records were read from the infile 'C:\temp.csv'.
The minimum record length was 0.
The maximum record length was 223.
NOTE: The data set WORK.HAVE has 112514 observations and 14 variables.
NOTE: DATA statement used (Total process time):
real time 1:39.06
cpu time 22.93 seconds
Your output statement is inside a block that will only output when
if COUNTW(temp,',','mq') >= 14
so some "short" combinations might not output as intended.
I'm also wondering if perhaps instead of
call missing(temp);
should be something to reduce temp to values after var13.
Using NotePad++ open that csv and see the term string is CR or LF (at south-east corner).
and add an option.
infile 'C:\temp.csv' delimiter = ',' termstr=CRLF;
infile 'C:\temp.csv' delimiter = ',' termstr=LF;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.