BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

Hello all,

I use SAS 9.4 PC version,

I have to add extra space between rows of dataline(cards),   otherwise will miss half data. please help.

I don't know why my post will add extra space automatically,if you copy my code there will be spaces betwween rows of data. my code don't has extra space.

data layout;

input a $1-500 ;

cards;

@1 CLASS $40.

@45 ID $10.

@61 Gailer $100.

@161 Mid $20.

@181 PERMIT $8.

@189 DEST $8.

@197 Rur $8.

@205 Month $8.

@223 Mac $40.

@263 Product $40.

@303 Weight_Range $8.

@326 Revenue 8.

@338 Pieces 8.

@350 Weight 8.

@365 MC_Doc $10.

@382 CP_Doc $10.

;

run;

 

 

data layout2;

input a $1-500 ;

cards;

@1 CLASS $40.

@45 ID $10.

@61 Gailer $100.

@161 Mid $20.

@181 PERMIT $8.

@189 DEST $8.

@197 Rur $8.

@205 Month $8.

@223 Mac $40.

@263 Product $40.

@303 Weight_Range $8.

@326 Revenue 8.

@338 Pieces 8.

@350 Weight 8.

@365 MC_Doc $10.

@382 CP_Doc $10.

;

run;

 

 

Thanks

4 REPLIES 4
zekeT_sasaholic
Quartz | Level 8

First. 

This process looks strange to me.  The reading of input criteria as card statements.

I wont judge as maybe you are using that as a mock up.

 

but try this...

 

data layout;
infile cards missover;
input a $1-500 ;
cards;
/** your card stuff **/
;
run;

hth

 

zeke torres

www.wcsug.com

zekeT_sasaholic
Quartz | Level 8

Kurt.

 

thanks - you are correct.

i did copy/cut/paste his code over and felt the infile would do the trick.

i tried before/after.

i got lazy on doing a proc print to test (although i did look at the log).

hence the half ass-ed success.

mea culpa.

 

fwiw - i have opted to not make any suggestions without the appropriate amount of coffee to complexity ratio.

 

best

z

Kurt_Bremser
Super User

Add

infile cards truncover;

before the input statement. Your explicit definition of $1-500 forces SAS to look for more characters than are present on the dataline, and so it skips to the next line. This is NOTEd in the log.

The truncover option just tells SAS to be OK with what's there on the input line, and not skip.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1821 views
  • 3 likes
  • 3 in conversation