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
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
@zekeT_sasaholic: missover won't work, as a is then set to missing on all observations.
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
I know this thread only got "reanimated" because of a SPAM message, but this post is a perfect example of why you should (almost) never be using the ancient MISSOVER infile option.
@zekeT_sasaholic wrote:
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
Using the MISSOVER option will prevent the input statement from moving to the next line when the current line does not have 500 remaining characters.
But it will also discard any line that has less than 500 characters (actually less than 481 since in-line data lines are always padded with spaces to the next multiple of 80 bytes).
Instead use the newer TRUNCOVER option (I think it is only 30 years old).
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.
datalines black colour
@datalines wrote:
datalines black colour
???
Please post something meaningful, or we'll have to assume that this is the account of a dumb bot intended to spam the communities.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.