Desktop productivity for business analysts and programmers

Running Programs in SAS EG 4.2

Reply
New Contributor
Posts: 3

Running Programs in SAS EG 4.2

I am failing to run a script in SAS EG 4.2 that works perfectly in SAS 9.2.

Here is the code:

Data Pnet_0_100_COOP;
input Trt $ Loc $ yresp se C_0_10 C_0_13 C_0_16 C_100_10 C_100_13 C_100_16 df;
T_0_10 = (C_0_10-yresp)/se;
P_0_10=1-(ProbT(T_0_10,df));
T_0_13 = (C_0_13-yresp)/se;
P_0_13=1-(ProbT(T_0_13,df));
T_0_16 = (C_0_16-yresp)/se;
P_0_16=1-(ProbT(T_0_16,df));
T_100_10 = (C_100_10-yresp)/se;
P_25_10=1-(ProbT(T_100_10,df));
T_100_13 = (C_100_13-yresp)/se;
P_25_13=1-(ProbT(T_100_13,df));
T_100_16 = (C_100_16-yresp)/se;
P_100_16=1-(ProbT(T_100_16,df));

datalines;
....
Run;
Proc Print data=Pnet_0_100_COOP;
Run;
Quit;

Not sure what I am doing wrong. SAS EG 4.2 doesn't seem to be reading the data lines the same way SAS 9.2 does. Any suggestions?

Bestor
PROC Star
Posts: 1,146

Re: Running Programs in SAS EG 4.2

I threw some junk data in and it seems to work fine in the EG 4.1 that I have at home.

Here are the log lines starting at the end of the step:

28 datalines;

NOTE: The data set WORK.PNET_0_100_COOP has 3 observations and 23 variables.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.01 seconds


32 Run;
33 Proc Print data=Pnet_0_100_COOP;
34 Run;

NOTE: There were 3 observations read from the data set WORK.PNET_0_100_COOP.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.20 seconds
cpu time 0.00 seconds


35 Quit;


Compare it with what you get out of EG; the problem may be apparent.
If not, I would suggest you post the log from EG.
New Contributor
Posts: 3

Re: Running Programs in SAS EG 4.2

Thanks Tom. Here is the log I have. The log says my data is invalid for all of the inputs. I am not sure why that would be. The program is directly copied from SAS 9.2.

29        

30        

31         datalines;

NOTE: Invalid data for yresp in line 34 1-61.

NOTE: Invalid data for se in line 35 1-61.

NOTE: Invalid data for C_0_10 in line 36 1-62.

NOTE: Invalid data for C_0_13 in line 37 1-63.

NOTE: Invalid data for C_0_16 in line 38 1-64.

NOTE: Invalid data for C_100_10 in line 39 1-64.

NOTE: Invalid data for C_100_13 in line 40 1-63.

NOTE: Invalid data for C_100_16 in line 41 1-61.

NOTE: Invalid data for df in line 42 1-61.

RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+

42  CHAR   R1Head.Suth2009.4.09.3.87.2.56.1.97.1.60.5.06.3.89.3.16.34.00                  

    ZONE   53466605776333303233032330323303233032330323303233032330332332222222222222222222

    NUMR   21851493548200994E0993E8792E5691E9791E6095E0693E8993E16934E000000000000000000000

NOTE: Invalid data errors for file CARDS occurred outside the printed range.

Message was edited by: Nathan Bestor

Attachment
Trusted Advisor
Posts: 2,114

Re: Running Programs in SAS EG 4.2

Bestor,

Maybe you can use some of the new features of the SAS communities to actually include sample code, with data, as an attachment.

Doc Muhlbaier

Duke

New Contributor
Posts: 3

Re: Running Programs in SAS EG 4.2

Thanks Doc,

See above.

Bestor

Trusted Advisor
Posts: 2,114

Re: Running Programs in SAS EG 4.2

When I ran this in batch SAS, I got the same error messages that you did in EGuide.  When I ran in interactive SAS, it ran fine.  (SAS 9.2 TS2M3).

The problem is in the default settings related to tab-delimited data.  I think, but have not tried, that you need to code an explicit INFILE statement for the datalines to include the tab as the delimiter.Alternatively, you could use a text editor to replace the tabs with spaces.

Doc Muhlbaier

Duke

Super User
Posts: 9,867

Re: Running Programs in SAS EG 4.2

Just as Doc@duck said, maybe it is because of your '09'x delimiter (tab character).

Title;
Title1 "Eg 4.2 Problem";
Data Pnet;
infile datalines dlm=' ' expandtabs;
input Trt $ Loc $ yresp se C_0_10 C_0_13 C_0_16 C_25_10 C_25_13 C_25_16 df;
T_0_10 = (C_0_10-yresp)/se;
     P_0_10=1-(ProbT(T_0_10,df));
T_0_13 = (C_0_13-yresp)/se;
     P_0_13=1-(ProbT(T_0_13,df));
T_0_16 = (C_0_16-yresp)/se;
     P_0_16=1-(ProbT(T_0_16,df));
T_25_10 = (C_25_10-yresp)/se;
     P_25_10=1-(ProbT(T_25_10,df));
T_25_13 = (C_25_13-yresp)/se;
     P_25_13=1-(ProbT(T_25_13,df));
T_25_16 = (C_25_16-yresp)/se;
     P_25_16=1-(ProbT(T_25_16,df));

datalines;
a     Central1     0.72572564     2.04     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     Central2     4.49     1.71     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     SW1     1.77     1.63     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     28
a     SE1     0.61     1.84     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     SE2     -0.73     1.97     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     SW2     2.15     2.27     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     N1     8.67     4     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     NE1     3.62     10.23     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     28
a     NE1     3.2     4.14     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
a     NW1     1.74     1.92     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     28
a     NW2     4.09     3.87     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     Central1     4.99156649     2.04     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     Central2     6.27     1.71     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     SW1     1.66     1.63     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     28
b     SE1     4.92     1.84     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     SE2     0.35     1.97     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     SW2     4.81     2.27     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     N1     6.67     4     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     NE1     5.25     10.23     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     28
b     NE1     3.69     4.14     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
b     NW1     7.27     1.92     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     28
b     NW2     -0.35     3.87     2.562     1.970769231     1.60125     5.062     3.893846154     3.16375     34
c     Central1     -1.64692377     2.04     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     Central2     5.81     1.71     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     SW1     2.37     1.63     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     28
c     SE1     -1.24     1.84     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     SE2     0.54     1.97     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     SW2     0.23     2.27     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     N1     0.92     4     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     NE1     4.01     10.23     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     28
c     NE1     3.94     4.14     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
c     NW1     2.69     1.92     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     28
c     NW2     -2.94     3.87     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     Central1     2.42152079     2.04     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     Central2     6.47     1.14     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     SW1     2.83     1.63     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     28
d     SE1     2.05     1.84     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     SE2     1.52     1.97     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     SW2     0.37     2.27     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     N1     4.93     4     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     NE1     3.64     10.23     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     28
d     NE1     3.29     4.14     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
d     NW1     4.55     1.92     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     28
d     NW2     -1.16     3.87     2.591     1.993076923     1.619375     5.091     3.916153846     3.181875     34
e     Central1     -2.63402407     2.04     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     Central2     -0.79     1.71     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     SW1     -0.1     1.63     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     28
e     SE1     1.53     1.84     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     SE2     -1.46     1.97     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     SW2     0.36     2.27     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     N1     2.78     4     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     NE1     2.22     10.23     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     28
e     NE1     0.73     4.14     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
e     NW1     1.45     1.92     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     28
e     NW2     -0.46     3.87     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     Central1     -1.21100871     2.04     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     Central2     1.37     1.71     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     SW1     1.32     1.63     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     28
f     SE1     2.39     1.84     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     SE2     0.02     1.97     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     SW2     0.86     2.27     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     N1     0.83     4     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     NE1     1.95     10.23     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     28
f     NE1     -1.66     4.14     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34
f     NW1     2.52     1.92     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     28
f     NW2     0.36     3.87     1.9     1.461538462     1.1875     4.4     3.384615385     2.75     34


Run;


Proc Print Data=Pnet;
Run;

Ksharp

Ask a Question
Discussion stats
  • 6 replies
  • 285 views
  • 0 likes
  • 4 in conversation