BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

Just read that into a different variable, call it EXTRA.  No need to change your delimiters.

You can even test if it looks like a TAG value (all digits) and and reset the column pointer to column 1 when it does so you don't end up reading the first TAG value into EXTRA and getting everything out of sync.

data x;
  infile "C:\Users\jwalker\Desktop\New folder (2)\FedLine32948_PCBB_FXWIRE_FEDLINE_202107201050.txt"
    dlm='{}' truncover
  ;
  length row col 8 extra tag $32 text $1000;
  row+1;
  input extra @;
  if not notdigit(extra) then input @1 @ ;
  do col=1 by 1 until(tag=' ');
    input tag text @;
    if tag ne ' ' then output;
  end;
run;

Looking at the documentation you might even want to make TAG a numeric variable since all of the values are 4 digit numbers.  Then you could add the extra input the first tag is missing.

data x;
  infile "C:\Users\jwalker\Desktop\New folder (2)\FedLine32948_PCBB_FXWIRE_FEDLINE_202107201050.txt"
    dlm='{}' truncover
  ;
  length row col tag 8 extra $32 text $1000;
  row+1;
  input tag ?? @1 @;
  if missing(tag) then input extra @ ;
  do col=1 by 1 until(missing(tag));
    input tag text @;
    if not missing(tag) then output;
  end;
run;
jimbobob
Quartz | Level 8
Man you're a genius, I've been trying to figure this out for 4 hours. Thank you so much.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 16 replies
  • 5827 views
  • 0 likes
  • 4 in conversation