BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bal23
Lapis Lazuli | Level 10

Thanks. But my file is not csv, it is *.dat

Reeza
Super User

Seriously? Woman Frustrated

 

A text file is a text file. CSV means it's comma separated, DAT files don't have a fixed structure, they can be tab delimited, space delimited and/or fixed width. 

 

Do you have a specification document that you can share?

 

gc -path "full path to your file.dat" - head N > "full path to output.txt"

 

 

 

 

 

Bal23
Lapis Lazuli | Level 10

Thanks. What is a full statement, with data step, proc?

Bal23
Lapis Lazuli | Level 10

 I c. you want me to use powershell. Any other suggestions?

Tom
Super User Tom
Super User

You don't need to use PowerShell to look at the records in your file. Just use SAS.  So to see the first 5 records run a simple data step like this and look at the log.

 

data _null_;
   infile 'myfilename' obs=5 ;
   input;
   list;
run;
Bal23
Lapis Lazuli | Level 10

no variable is found

it did not print anything

i changed the name to "abc"  still there is no variable

Bal23
Lapis Lazuli | Level 10

Thanks. I did see something after run your code. but i do not understand much

 

Bal23
Lapis Lazuli | Level 10

I also used input put to see the rest of variables that sas cannot read in but it looks fine when I use input put

i just do not know why the first step read in cannot read all those variables, cannot read them correctly

it can read the first 100+ variable right
any other advice

Reeza
Super User

My guess is your input statement is wrong. 

 

Post the full statement. 

Reeza
Super User

If you can't post sample data or code in public, then I suggest tech support as they can deal with your code and file in a secure manner. And that's what you pay for anyways. 

 

I've posted a Powershell script to create a smaller file to work with and Tom's posted SAS code to generate a few lines. You can print those back out to a text file to create the file. 

 

Good Luck. 

Tom
Super User Tom
Super User

Here is another debugging hint.

If it reads the first 105 variables correctly then I suggest that pay careful attention to the part of the INPUT statement starting at that point. You will most likely find your cause there.  

 

Bal23
Lapis Lazuli | Level 10

Tom, thank you for the tip

 

 

is it possible that I have not formated the date correctly it cannot read?

Reeza
Super User

Read it as character if you have any doubts. Your using a column pointer method so it shouldn't affect other variables anyway, only the variable in question. 

Bal23
Lapis Lazuli | Level 10
  • I read it as charcters already. Just do not know why it cannot read through and read the whole record correctly

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 41 replies
  • 1767 views
  • 3 likes
  • 5 in conversation