Thanks. But my file is not csv, it is *.dat
Seriously?
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"
Thanks. What is a full statement, with data step, proc?
I c. you want me to use powershell. Any other suggestions?
thank you
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;
no variable is found
it did not print anything
i changed the name to "abc" still there is no variable
Thanks. I did see something after run your code. but i do not understand much
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
My guess is your input statement is wrong.
Post the full statement.
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.
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.
Tom, thank you for the tip
is it possible that I have not formated the date correctly it cannot read?
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.