Hello everyone,
Kind of struggle to read in completely of this data as below:
The issue is the Limitation and Counts variables.
If I use Limitation :$ Counts,
then there would be printing some values for Counts,
However, that way some characters in "Limitation" would be eliminated.
Did I miss anything here?
Any help would be highly appreciated.
Thanks!
data activity; input Age $ Gender $ 8-9 Race $7. Poverty $4. Limitation :$5. Counts @@; cards; 10–14 M whites low Major 5 10–14 M whites med Major 21 10–14 M whites hig Major 21 10–14 M other low Major 53 10–14 M other med Major 102 10–14 M other hig Major 52 10–14 F whites low Major 1 10–14 F whites med Major 11 10–14 F whites hig Major 15 10–14 F other low Major 21 10–14 F other med Major 52 10–14 F other hig Major 28 15–19 M whites low Major 1 15–19 M whites med Major 13 15–19 M whites hig Major 21 15–19 M other low Major 36 15–19 M other med Major 86 15–19 M other hig Major 40 15–19 F whites low Major 6 15–19 F whites med Major 8 15–19 F whites hig Major 17 15–19 F other low Major 42 15–19 F other med Major 73 15–19 F other hig Major 26 10–14 M whites low Other 2 10–14 M whites med Other 14 10–14 M whites hig Other 6 10–14 M other low Other 16 10–14 M other med Other 36 10–14 M other hig Other 21 10–14 F whites low Other 2 10–14 F whites med Other 2 10–14 F whites hig Other 3 10–14 F other low Other 17 10–14 F other med Other 33 10–14 F other hig Other 12 15–19 M whites low Other 2 15–19 M whites med Other 8 15–19 M whites hig Other 7 15–19 M other low Other 28 15–19 M other med Other 42 15–19 M other hig Other 23 15–19 F whites low Other 3 15–19 F whites med Other 7 15–19 F whites hig Other 2 15–19 F other low Other 31 15–19 F other med Other 36 15–19 F other hig Other 29 10–14 M whites low None 102 10–14 M whites med None 336 10–14 M whites hig None 285 10–14 M other low None 827 10–14 M other med None 1518 10–14 M other hig None 667 10–14 F whites low None 87 10–14 F whites med None 304 10–14 F whites hig None 302 10–14 F other low None 846 10–14 F other med None 1452 10–14 F other hig None 687 15–19 M whites low None 91 15–19 M whites med None 326 15–19 M whites hig None 313 15–19 M other low None 888 15–19 M other med None 1509 15–19 M other hig None 725 15–19 F whites low None 115 15–19 F whites med None 344 15–19 F whites hig None 286 15–19 F other low None 817 15–19 F other med None 1500 15–19 F other hig None 716 ; run; proc print data=activity; run;
I copied your program to Notepad++, and can see that the data lines are tab delimited.
This code works for me:
data activity;
length age $7 gender $1 race $7 poverty $3 limitation $5 ;
infile datalines dlm='09'x dsd missover;
input Age Gender Race Poverty Limitation Counts ;
datalines;
10–14 M whites low Major 5
10–14 M whites med Major 21
10–14 M whites hig Major 21
10–14 M other low Major 53
10–14 M other med Major 102
10–14 M other hig Major 52
10–14 F whites low Major 1
10–14 F whites med Major 11
10–14 F whites hig Major 15
10–14 F other low Major 21
10–14 F other med Major 52
10–14 F other hig Major 28
15–19 M whites low Major 1
15–19 M whites med Major 13
15–19 M whites hig Major 21
15–19 M other low Major 36
15–19 M other med Major 86
15–19 M other hig Major 40
15–19 F whites low Major 6
15–19 F whites med Major 8
15–19 F whites hig Major 17
15–19 F other low Major 42
15–19 F other med Major 73
15–19 F other hig Major 26
10–14 M whites low Other 2
10–14 M whites med Other 14
10–14 M whites hig Other 6
10–14 M other low Other 16
10–14 M other med Other 36
10–14 M other hig Other 21
10–14 F whites low Other 2
10–14 F whites med Other 2
10–14 F whites hig Other 3
10–14 F other low Other 17
10–14 F other med Other 33
10–14 F other hig Other 12
15–19 M whites low Other 2
15–19 M whites med Other 8
15–19 M whites hig Other 7
15–19 M other low Other 28
15–19 M other med Other 42
15–19 M other hig Other 23
15–19 F whites low Other 3
15–19 F whites med Other 7
15–19 F whites hig Other 2
15–19 F other low Other 31
15–19 F other med Other 36
15–19 F other hig Other 29
10–14 M whites low None 102
10–14 M whites med None 336
10–14 M whites hig None 285
10–14 M other low None 827
10–14 M other med None 1518
10–14 M other hig None 667
10–14 F whites low None 87
10–14 F whites med None 304
10–14 F whites hig None 302
10–14 F other low None 846
10–14 F other med None 1452
10–14 F other hig None 687
15–19 M whites low None 91
15–19 M whites med None 326
15–19 M whites hig None 313
15–19 M other low None 888
15–19 M other med None 1509
15–19 M other hig None 725
15–19 F whites low None 115
15–19 F whites med None 344
15–19 F whites hig None 286
15–19 F other low None 817
15–19 F other med None 1500
15–19 F other hig None 716
;
run;
proc print data=activity; run;
input Age $ Gender $ 8-9 Race :$7. Poverty : $4. Limitation :$5. Counts ;
I copied your program to Notepad++, and can see that the data lines are tab delimited.
This code works for me:
data activity;
length age $7 gender $1 race $7 poverty $3 limitation $5 ;
infile datalines dlm='09'x dsd missover;
input Age Gender Race Poverty Limitation Counts ;
datalines;
10–14 M whites low Major 5
10–14 M whites med Major 21
10–14 M whites hig Major 21
10–14 M other low Major 53
10–14 M other med Major 102
10–14 M other hig Major 52
10–14 F whites low Major 1
10–14 F whites med Major 11
10–14 F whites hig Major 15
10–14 F other low Major 21
10–14 F other med Major 52
10–14 F other hig Major 28
15–19 M whites low Major 1
15–19 M whites med Major 13
15–19 M whites hig Major 21
15–19 M other low Major 36
15–19 M other med Major 86
15–19 M other hig Major 40
15–19 F whites low Major 6
15–19 F whites med Major 8
15–19 F whites hig Major 17
15–19 F other low Major 42
15–19 F other med Major 73
15–19 F other hig Major 26
10–14 M whites low Other 2
10–14 M whites med Other 14
10–14 M whites hig Other 6
10–14 M other low Other 16
10–14 M other med Other 36
10–14 M other hig Other 21
10–14 F whites low Other 2
10–14 F whites med Other 2
10–14 F whites hig Other 3
10–14 F other low Other 17
10–14 F other med Other 33
10–14 F other hig Other 12
15–19 M whites low Other 2
15–19 M whites med Other 8
15–19 M whites hig Other 7
15–19 M other low Other 28
15–19 M other med Other 42
15–19 M other hig Other 23
15–19 F whites low Other 3
15–19 F whites med Other 7
15–19 F whites hig Other 2
15–19 F other low Other 31
15–19 F other med Other 36
15–19 F other hig Other 29
10–14 M whites low None 102
10–14 M whites med None 336
10–14 M whites hig None 285
10–14 M other low None 827
10–14 M other med None 1518
10–14 M other hig None 667
10–14 F whites low None 87
10–14 F whites med None 304
10–14 F whites hig None 302
10–14 F other low None 846
10–14 F other med None 1452
10–14 F other hig None 687
15–19 M whites low None 91
15–19 M whites med None 326
15–19 M whites hig None 313
15–19 M other low None 888
15–19 M other med None 1509
15–19 M other hig None 725
15–19 F whites low None 115
15–19 F whites med None 344
15–19 F whites hig None 286
15–19 F other low None 817
15–19 F other med None 1500
15–19 F other hig None 716
;
run;
proc print data=activity; run;
Thank you very much!
Earlier I just try to reduce the length of the data points so I can move on.
Thank you for helping!
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.