BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
najiah
Calcite | Level 5

The actual data could be find the attachment (DAT file)

The editor that I wrote:

DATA example;

INFILE 'C:\Users\nadzatul.abdullah\Documents\My SAS Files\9.3\example.dat';

INPUT Gender $1. +1 Race $1. +1 (Q1-Q120) (2.5);

RUN;

PROC PRINT DATA = example;

TITLE 'example';

RUN;

The output looks like this:

There are no output for Q1-Q13. How to extract the output so that they are exist in the table?

Hope that you guys able to help me to solve this problem.

Thank you so much Smiley Happy

                                                                                                                             

1 ACCEPTED SOLUTION

Accepted Solutions
bnarang
Calcite | Level 5

So, you have more than 13 rows of data in your input file and they are delimited by "TAB" I believe. To read them, you need to give right options in infile statement which is clearly specifiying the dlm ='<options>'.

In your case,

for Tab delimited file, it should be '09'x and dsd option  .

so, code would be:

data temp;

infile "D:\example.dat" dlm ='09'x dsd;

input x1 x2 x3 x4;

run;

Here, I just took only 1st four set of columns, you can include all of them and run.

View solution in original post

2 REPLIES 2
bnarang
Calcite | Level 5

So, you have more than 13 rows of data in your input file and they are delimited by "TAB" I believe. To read them, you need to give right options in infile statement which is clearly specifiying the dlm ='<options>'.

In your case,

for Tab delimited file, it should be '09'x and dsd option  .

so, code would be:

data temp;

infile "D:\example.dat" dlm ='09'x dsd;

input x1 x2 x3 x4;

run;

Here, I just took only 1st four set of columns, you can include all of them and run.

najiah
Calcite | Level 5

Thank you so much.

Finally, I succeeded to import the data with your help.

Have a good day!

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!

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
  • 2 replies
  • 583 views
  • 0 likes
  • 2 in conversation