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
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.
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.
Thank you so much.
Finally, I succeeded to import the data with your help.
Have a good day!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.