BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jacksonan123
Lapis Lazuli | Level 10
 ID                    TIME              CMT               Y1               Y2        
 1.0000E+00  0.0000E+00  1.0000E+00  0.0000E+00  0.0000E+00  0.0000E+00  0.0000E+00  0.0000E+00  1.0000E+00  1.0000E+00     2.4000E+01  2.4000E+01  2.4000E+01  4.2881E+00  4.9617E+01  
 ID                  TIME                CMT               Y1                Y2         
1.0000E+00  0.0000E+00  1.0000E+00  0.0000E+00    0.0000E+00  0.0000E+00  1.0000E+00  2.0000E+00  0.0000E+00   0.0000+00

The inserted data file has the labels ID Time etc inserted whenever the subject number repeats.


data one;
infile '/folders/myfolders/partialauc/testsimjuvpilot3.fit'  DLM='09'X dsd truncover;
input chk $ @;
if chk='id' then delete;
else input @1 id time cmt;
drop chk;
run;
 
proc print; 
run;

The inserted SAS code contained DLM='09'x  which worked with another text file as suggested by an answer to my prior post.

 

However I get the following error:


 NOTE: The infile '/folders/myfolders/partialauc/testsimjuvpilot3.fit' is:
       Filename=/folders/myfolders/partialauc/testsimjuvpilot3.fit,
       Owner Name=root,Group Name=root,
       Access Permission=-rwxrwxrwx,
       Last Modified=06Mar2020:23:47:59,
       File Size (bytes)=10325855
 
 NOTE: Invalid data for id in line 1 1-305.
 RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 1          ID          TIME        CMT         Y1          Y2          CP1         CP2         DV          MDV
      101  X        COUNT       RHYD        RHYL        RMETD       RMETL       CDLV        CLLV        CVD   
      201       CVL         CRESI       CWRESI      CRES        CWRES       DV          PRED        RES       
      301   WRES 305
 chk=ID id=. time=. cmt=. _ERROR_=1 _N_=1
 NOTE: Invalid data for id in line 2 1-312.

 

I didn't put in all of the data but the error is still applicable.  Can someone tell me why the DLM='09'X addition to the input line failed to work for this input data?  Since it did not work how should the input line be modified?

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Based on the data you've posted looks like string ID is all uppercase. 

 

May be try in your code:

if upcase(chk)='ID' then delete;

 

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

Open the file with a proper text editor, preferably Notepad++.

Open a window here with the {i} button.

Copy/paste a few lines into that subwindow.

Send the post.

 

Or rename the file to something.txt, so you can attach it to your post.

 

Only then will we be able to properly inspect the file's contents. Note that Notepad++ provides a hex view which assists in finding what delimiters you need. You might also find, on opening, that your file does not use delimiters, but fixed-width columns.

jacksonan123
Lapis Lazuli | Level 10
I just posted a part of the file edited with Notepad++.

The file is very large so I can't post the entire file.
Patrick
Opal | Level 21

Based on the data you've posted looks like string ID is all uppercase. 

 

May be try in your code:

if upcase(chk)='ID' then delete;

 

Kurt_Bremser
Super User

There are no tabs in the data you posted, so this works:

data want;
input@;
if index(upcase(_infile_),'ID')
then delete;
else input id time cmt;
datalines;
 ID                    TIME              CMT               Y1               Y2        
 1.0000E+00  0.0000E+00  1.0000E+00  0.0000E+00  0.0000E+00  0.0000E+00  0.0000E+00  0.0000E+00  1.0000E+00  1.0000E+00     2.4000E+01  2.4000E+01  2.4000E+01  4.2881E+00  4.9617E+01  
 ID                  TIME                CMT               Y1                Y2         
1.0000E+00  0.0000E+00  1.0000E+00  0.0000E+00    0.0000E+00  0.0000E+00  1.0000E+00  2.0000E+00  0.0000E+00   0.0000+00
;

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