BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
urban58
Quartz | Level 8

I'm trying to create a series of SAS datasets of ICD codes given to me in a word doc but I'm having trouble reading the data in

have1
S83.51, S83.511A, S83.511D, S83.511S, S83.512A, S83.512D, S83.512S, S83.519A, S83.519D, S83.519S

 

want1

code
S83.51
S83.511A
S83.511D
S83.511S
S83.512A
S83.512D
S83.512S
S83.519A
S83.519D
S83.519S

 

have2
29888, 27407, 27427, 27428, 27429

want2

code

29888

27407

27427

27428

27429

 

data have;
4969 infile DATALINES delimiter=',' missover;
4970 input code $8;
4971 cards;

NOTE: The data set WORK.HAVE has 0 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds


4971 S83.51, S83.511A, S83.511D, S83.511S, S83.512A, S83.512D, S83.512S, S83.519A, S83.519D,
------
180
4972 ! S83.519S ;

ERROR 180-322: Statement is not valid or it is used out of proper order.

4973 run;

I would appreciate any help,

Maggie

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

This perhaps:

data read;
   infile datalines dlm=',';
   input code :$9. @@ ;
datalines;
S83.51, S83.511A, S83.511D, S83.511S, S83.512A, S83.512D, S83.512S, S83.519A, S83.519D, S83.519S
;

The @@ at the end of input holds the input line for multiple reads. You also didn't have an actual Informat specified (missed the .)

 

Please post log into a text box opened using the </> icon that appears above the message window. Note that the log bit you show doesn't match what you see in your log window? This forum reformats everything pasted into the main message window and results in moving things like the diagnostic characters in the error message.

View solution in original post

2 REPLIES 2
ballardw
Super User

This perhaps:

data read;
   infile datalines dlm=',';
   input code :$9. @@ ;
datalines;
S83.51, S83.511A, S83.511D, S83.511S, S83.512A, S83.512D, S83.512S, S83.519A, S83.519D, S83.519S
;

The @@ at the end of input holds the input line for multiple reads. You also didn't have an actual Informat specified (missed the .)

 

Please post log into a text box opened using the </> icon that appears above the message window. Note that the log bit you show doesn't match what you see in your log window? This forum reformats everything pasted into the main message window and results in moving things like the diagnostic characters in the error message.

urban58
Quartz | Level 8
Thanks ballardw,, your code works!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 432 views
  • 0 likes
  • 2 in conversation