BookmarkSubscribeRSS Feed
DanD
Calcite | Level 5
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
3 REPLIES 3
DanD
Calcite | Level 5
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
DanD
Calcite | Level 5
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
DanD
Calcite | Level 5
I discovered the problem. Apparently SAS EG doesn't like tabs when entering data. When I removed the tabs the original code worked.

DanD

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1072 views
  • 0 likes
  • 1 in conversation