Desktop productivity for business analysts and programmers

help with error in code

Reply
Contributor
Posts: 32

help with error in code

I'm obviously new to SAS and EG4.1. I'm wrting code directly in the code window. When I run the following code I only get the first line of code and I don't know why. You can't tell it here but I started the Name in column 6, the team data in column 25 and StartWeight in column 33, then one space and EndWeight. Any help is appreciated.

data weight_club;
input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight;
Loss=StartWeight - EndWeight;
datalines;
2023 David Shaw red 189 165
1049 Amelia Serrano yellow 145 124
;
run;

The output is:
2023 David Shaw red 189 165 24

Thanks,

DanD
Contributor
Posts: 32

Re: help with error in code

I looked in the log after I posted and this is what's there:
1 The SAS System 08:40 Friday, February 26, 2010

1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL=%NRBQUOTE(Code);
4 %LET _EGTASKLABEL=%NRBQUOTE(Code);
5 %LET _CLIENTPROJECTNAME=%NRBQUOTE();
6 %LET _SASPROGRAMFILE=;
7
8 ODS _ALL_ CLOSE;
NOTE: Some of your options or statements may not be supported with the Activex or Java series of devices. Graph defaults for these
drivers may be different from other SAS/GRAPH device drivers. For further information, please contact Technical Support.
9 OPTIONS DEV=ACTIVEX;
10 FILENAME EGHTML TEMP;
NOTE: Writing HTML(EGHTML) Body file: EGHTML
11 ODS HTML(ID=EGHTML) FILE=EGHTML ENCODING='utf-8' STYLE=EGDefault
11 ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/Shared%20Files/BIClientStyles/EGDefault.css")
11 ! ATTRIBUTES=("CODEBASE"="http://www2.sas.com/codebase/graph/v91/sasgraph.exe") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation
11 ! ;
12
13 %gaccessible;
14 data weight_club;
15 input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight;
16 Loss=StartWeight - EndWeight;
17 datalines;

NOTE: Invalid data for StartWeight in line 19 33-39.
NOTE: LOST CARD.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
20 ;
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
IdNumber=1049 Name=Amelia Serrano Team=yellow StartWeight=. EndWeight=. Loss=. _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.WEIGHT_CLUB has 1 observations and 6 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 508k
Page Faults 0
Page Reclaims 206
Page Swaps 0
Voluntary Context Switches 8
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0


20 ;
21 run;
22
23 %LET _CLIENTTASKLABEL=;
24 %LET _EGTASKLABEL=;
25 %LET _CLIENTPROJECTNAME=;
26 %LET _SASPROGRAMFILE=;
27
28 ;*';*";*/;quit;run;
29 ODS _ALL_ CLOSE;
30
2 The SAS System 08:40 Friday, February 26, 2010

31
32 QUIT; RUN;
33

Maybe that will give someone a clue.

Thanks,

DanD
Contributor
Posts: 32

Re: help with error in code

I don't really understand why but when I changed the input line from this
input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight;
to this
input IdNumber Name $ 6-24 Team $ StartWeight EndWeight;

and left the data the same, the program picked up both observations. I took this code from the SAS Step by Step Programming book so I assume it should work the original way. If anyone can clue me in as to how to get the original code to work, I would appreciate it.

Thanks,

DanD
Contributor
Posts: 32

Re: help with error in code

I discovered the problem. Apparently SAS EG doesn't like tabs when entering data. When I removed the tabs the original code worked.

DanD
Ask a Question
Discussion stats
  • 3 replies
  • 168 views
  • 0 likes
  • 1 in conversation