can any one please help me this
data club;
infile datalines dsd;
input idnumber 1-4
name : $18.
team : $25-30
startwi endwi;
datalines;
1023 DAVID shaw RED 189 155
1049 AMELIA verna YELLOW 145 125
1219 ALAN ranju red 210 192
1246 RAVI shankar YELLOW 177 177
1078 ASHELY valley RED 127 118
1221 JIM rose YELLOW 220 220
;
proc print data=club;
id idnumber;
run;
output is getting worng
pls check once
idnumber name team startwi endwi.121
. | . | ||
9 ALAN ranju red 2 | 192 | . | . |
can any one please help me this
data club;
infile datalines dsd;
input idnumber 1-4
name : $18.
team : $25-30
startwi endwi;
datalines;
1023 DAVID shaw RED 189 155
1049 AMELIA verna YELLOW 145 125
1219 ALAN ranju red 210 192
1246 RAVI shankar YELLOW 177 177
1078 ASHELY valley RED 127 118
1221 JIM rose YELLOW 220 220
;
proc print data=club;
id idnumber;
run;
output is getting worng
pls check once
pls check the log once
The log is pure TEXT and can be copy/pasted into a window opened with the {i} button (use that button to preserve the formatting).
Post the complete log of the step (include all step code). If you are reading from an external file, attach that file (at least a few lines that cause the ERRORs) to your post. Or use the same method as mentioned for the log to post the text.
Also see this helper page: https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 70 71 72 data club; 73 infile datalines dsd; 74 input idnumber 1-4 75 name : $18. 76 team : $25-30 77 startwi endwi; 78 datalines; NOTE: Invalid data for startwi in line 80 1-33. NOTE: Invalid data for endwi in line 81 1-28. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 81 CHAR .1219 ALAN ranju red 210 192 ZONE 03333244442766672766233323332222222222222222222222222222222222222222222222222222 NUMR 9121901C1E021EA50254021001920000000000000000000000000000000000000000000000000000 NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. idnumber=102 name=3 DAVID shaw RED 1 team=155 startwi=. endwi=. _ERROR_=1 _N_=1 NOTE: Invalid data for startwi in line 83 1-31. NOTE: Invalid data for endwi in line 84 1-29. 84 CHAR .1221 JIM rose YELLOW 220 220 ZONE 03333244427676254444523332333222222222222222222222222222222222222222222222222222 NUMR 912210A9D02F35095CCF702200220000000000000000000000000000000000000000000000000000 NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. idnumber=124 name=6 RAVI shankar YEL team=W 177 startwi=. endwi=. _ERROR_=1 _N_=2 NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.CLUB has 2 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 790.53k OS Memory 29352.00k Timestamp 03/12/2018 07:39:46 AM Step Count 230 Switch Count 2 Page Faults 0 Page Reclaims 144 Page Swaps 0 Voluntary Context Switches 10 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 272 85 ; 86 86 ! proc print data=club; 87 id idnumber; 88 run; NOTE: There were 2 observations read from the data set WORK.CLUB. NOTE: PROCEDURE PRINT used (Total process time): real time 0.01 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 1582.09k OS Memory 29352.00k Timestamp 03/12/2018 07:39:46 AM Step Count 231 Switch Count 0 Page Faults 0 Page Reclaims 150 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 8 89 90 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 102
So let's have a look at your datalines:
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 81 CHAR .1219 ALAN ranju red 210 192 ZONE 03333244442766672766233323332222222222222222222222222222222222222222222222222222 NUMR 9121901C1E021EA50254021001920000000000000000000000000000000000000000000000000000
First, you can see that your dataline starts with a tab character (hex 09) that should not be there.
Then you use dsd, but have no quotes around text values, and you use a specific position (25-30) for team; looking at the dataline, one can see that there is nothing there after @30, so SAS skips to the next line to read startwi and endwi, stumbling there.
The dsd also causes SAS to interpret the whole line as 1 data item.
Try this code instead:
data club;
infile datalines;
input
idnumber
name1 $
name2 $
team $
startwi
endwi
;
datalines;
1219 ALAN ranju red 210 192
1221 JIM rose YELLOW 220 220
;
run;
The problem is that your NAME variable is not read correctly. It consists of first name and last name, but the way you read it only the first name gets into the NAME variable. You can do it like this, provided that you do not suddenly get a person with a middle name:
data club;
infile datalines;
length idnumber 8 firstname lastname $10 team $6 startwi endwi 8;
input idnumber--endwi;
datalines;
1023 DAVID shaw RED 189 155
1049 AMELIA verna YELLOW 145 125
1219 ALAN ranju red 210 192
1246 RAVI shankar YELLOW 177 177
1078 ASHELY valley RED 127 118
1221 JIM rose YELLOW 220 220
;
run;
Below code will also give u ur desired output:-
data club;
infile datalines dsd;
input idnumber 1-4 @5 name $14. @20 team $6. @27 startwi 3. @31 endwi;
datalines;
1023 DAVID shaw RED 189 155
1049 AMELIA verna YELLOW 145 125
1219 ALAN ranju red 210 192
1246 RAVI shankar YELLOW 177 177
1078 ASHELY valley RED 127 118
1221 JIM rose YELLOW 220 220
;
proc print data=club;
id idnumber;
run;
Hi,
The problem is that the data here is non standard data with out delimiter.
For the non standard data with out delimiter how can you use column input method.?
Why Dsd you have written it is just a space delimiter data?
And After the name the data should contain 2 spaces in the data. or you can split the Name variable into two like first name and lastname.
Try.
data club;
infile datalines;
input idnumber 1-4
name $&13.
team :$
startwi endwi;
datalines;
1023 DAVID shaw RED 189 155
1049 AMELIA verna YELLOW 145 125
1219 ALAN ranju red 210 192
1246 RAVI shankar YELLOW 177 177
1078 ASHELY valley RED 127 118
1221 JIM rose YELLOW 220 220
;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.