BookmarkSubscribeRSS Feed
Emma12
Calcite | Level 5

Hello, I am experiencing an issue with a homework I am working on. Here is the code: 

proc import file="/home/filepath.txt"
out=hw3
dbms=tab
replace;
run;

I attached two pics one of the actual data and one of the message I get. So the file has space between columns but it is not working to read the data.

I appreciate your help.

Thank you!

 

2 REPLIES 2
Tom
Super User Tom
Super User

Don't bother the paste pictures into PDF files and upload the file.  If you must take a photograph of text at least just paste the photograph directly into you message (or use the Insert Photos icon to upload an image file with the photo).  But the best way to share text, like lines from the SAS LOG, is to just copy the actual text and paste it into the pop-up window you get with the Insert Code icon.

 

Your error messages appear to be caused by unbalanced quotes and probably have nothing to do with the content of the file.

We cannot tell form the picture you took of the text file what it actually contains since we cannot tell what tool you are using to look at the contents of the file.

 

To see what is in the file you can just use SAS to read it (or part of it) and dump it to the SAS log.  For example to see what it in the first 5 lines you a data step like this:

data _null_;
  infile "/home/filepath.txt" obs=5;
  input;
  list;
run;

If the text does include TAB characters then the LIST statement will generate two extra lines per line that show the actual code for the characters. 09 is the code for a TAB. 20 is the code for a SPACE.

 

If you have a fixed length record then just read the file with a normal data step and tell it which column to use for each variable. Either with column mode or formatted mode input statement.

 

ballardw
Super User

Hint: Do not do any filtering to just show errors from the log. You need to show the entire procedure code submitted and all the lines, note, warnings or messages as well as the errors.

Quite often, especially with newer SAS users, the problem reported on one line can be caused by something missing or additional on a previous line that does not cause an "error" until later in the code.

 

Notice that all of the error lines that you do show have an underline starting at a quote mark and the second of a pair at that. This tells us that something involving a quote on a previous line is likely involved.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 766 views
  • 2 likes
  • 3 in conversation