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

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;
1 ACCEPTED SOLUTION

Accepted Solutions
SuzanneDorinski
Lapis Lazuli | Level 10

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;

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20
input Age $	Gender $ 8-9 Race :$7. Poverty : $4. Limitation :$5. Counts  ; 
SuzanneDorinski
Lapis Lazuli | Level 10

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;
jc3992
Pyrite | Level 9

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!

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 3 replies
  • 2450 views
  • 1 like
  • 3 in conversation