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
;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2651 views
  • 0 likes
  • 3 in conversation