BookmarkSubscribeRSS Feed
Dahcilsam
Calcite | Level 5

Hi everyone,

Please I am trying to create some new  variables to a SAS data set through the use of an assignment statement within the DATA step, and the process add been coming back with an error message as shown in green color statements below. Please I will appreciate it if anyone can put me through on what the problem and the possible way to tackle the error is.  The following are the log statements, showing the data step and the error messages, Thanks in anticipation of a helpful response.

NOTE: SAS (r) Proprietary Software 9.4 (TS1M1)

      Licensed to MISSISSIPPI STATE UNIVERSITY - SFA T&R, Site 70084845.

NOTE: This session is executing on the X64_7PRO  platform.

NOTE: Updated analytical products:

      SAS/STAT 13.1

      SAS/ETS 13.1

      SAS/OR 13.1

      SAS/IML 13.1

      SAS/QC 13.1

NOTE: Additional host information:

X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

NOTE: SAS initialization used:

      real time           1.24 seconds

      cpu time            0.95 seconds

1    TITLE1 'Analysis of the 2010 Pontotoc Populus Consolidated Test Ages 1-4';

2    FOOTNOTE1 "Potential Gains from Selection of Eastern Cottonwood and Hybrid Poplars on";

3    FOOTNOTE2 "Lower Mississippi Alluvial Floodplain and Upland Site";

4

5    PROC IMPORT OUT= WORK.PPpTEST2010

6    DATAFILE= "E:\sasmi\NiuDATA2010PontotocTestAge1to4.xlsx"

7        DBMS=EXCELCS;

8        SCANTEXT=YES;

9        USEDATE=YES;

10       SCANTIME=YES;

11   RUN;

NOTE: WORK.PPPTEST2010 data set was successfully created.

NOTE: The data set WORK.PPPTEST2010 has 480 observations and 15 variables.

NOTE: PROCEDURE IMPORT used (Total process time):

      real time           0.42 seconds

      cpu time            0.12 seconds

12    VOL2 = (0.21099 + (0.00221 * ((AGE2D*AGE2D) * AGE2HT));

       ----

        180

        ERROR 180-322: Statement is not valid or it is used out of proper order.

13     VOL3 = (0.21099 + (0.00221 * ((AGE3D*AGE3D) * AGE3HT));

          ----

         180

         ERROR 180-322: Statement is not valid or it is used out of proper order.

14    VOL4 = (0.21099 + (0.00221 * ((AGE4D*AGE4D) * AGE4HT));

         ----

        180

        ERROR 180-322: Statement is not valid or it is used out of proper order.

7 REPLIES 7
tlk
Quartz | Level 8 tlk
Quartz | Level 8

Hello,

Where is you data step ?

Assuming you want to add vol2, vol3 and vol4 to ppptest2010, I would do it like this:

data ppptest2010;

    set ppptest2010;

    VOL2 = (0.21099 + (0.00221 * ((AGE2D*AGE2D) * AGE2HT));

    VOL3 = (0.21099 + (0.00221 * ((AGE3D*AGE3D) * AGE3HT));

    VOL4 = (0.21099 + (0.00221 * ((AGE4D*AGE4D) * AGE4HT));

run;

Laurent

Dahcilsam
Calcite | Level 5

Here is the data step;

TITLE1 'Analysis of the 2010 Pontotoc Populus Consolidated Test Ages 1-4';

FOOTNOTE1 "Potential Gains from Selection of Eastern Cottonwood and Hybrid Poplars on";

FOOTNOTE2 "Lower Mississippi Alluvial Floodplain and Upland Site";

PROC IMPORT OUT= WORK.PPpTEST2010

DATAFILE= "E:\sasmi\NiuDATA2010PontotocTestAge1to4.xlsx"

    DBMS=EXCELCS;

    SCANTEXT=YES;

    USEDATE=YES;

    SCANTIME=YES;

RUN;

    *IF COMM11='99' THEN DELETE;

    *IF COMM12='99' THEN DELETE;

    *IF COMM21='99' THEN DELETE;

    *IF COMM22='99' THEN DELETE;

    *IF COMM31='99' THEN DELETE;

    *IF COMM32='99' THEN DELETE;

    *IF COMM41='99' THEN DELETE;

    *IF COMM42='99' THEN DELETE;

VOL2 = ( 0.21099 + ( 0.00221 * (( AGE2D * AGE2D ) * AGE2HT ));

VOL3 = ( 0.21099 + ( 0.00221 * (( AGE3D * AGE3D ) * AGE3HT ));

VOL4 = ( 0.21099 + ( 0.00221 * (( AGE4D * AGE4D ) * AGE4HT ));

*PROC SORT;

*BY BLOCK CLONE;

*PROC MEANS NOPRINT;

*BY BLOCK CLONE;

*VAR AGE1HT AGE2D AGE2HT AGE3D AGE3HT AGE4D AGE4HT VOL2 VOL3 VOL4;

*OUTPUT OUT=GENOTYPE MEAN=AGE1HT AGE2D AGE2HT AGE3D AGE3HT AGE4D AGE4HT VOL2 VOL3 VOL4;

PROC GLM;

CLASS BLOCK CLONE;

MODEL AGE1HT AGE2D AGE2HT VOL2 AGE3D AGE3HT VOL3 AGE4D AGE4HT VOL4=BLOCK CLONE BLOCK*CLONE;

LSMEANS BLOCK;

MEANS BLOCK/DUNCAN ALPHA=0.01;

LSMEANS CLONE;

MEANS CLONE/DUNCAN ALPHA=0.01;

RUN;

tlk
Quartz | Level 8 tlk
Quartz | Level 8

Hello,

Your assignment should be in a data step:

TITLE1 'Analysis of the 2010 Pontotoc Populus Consolidated Test Ages 1-4';

FOOTNOTE1 "Potential Gains from Selection of Eastern Cottonwood and Hybrid Poplars on";

FOOTNOTE2 "Lower Mississippi Alluvial Floodplain and Upland Site";

PROC IMPORT OUT= WORK.PPpTEST2010

DATAFILE= "E:\sasmi\NiuDATA2010PontotocTestAge1to4.xlsx"

    DBMS=EXCELCS;

    SCANTEXT=YES;

    USEDATE=YES;

    SCANTIME=YES;

RUN;

    *IF COMM11='99' THEN DELETE;

    *IF COMM12='99' THEN DELETE;

    *IF COMM21='99' THEN DELETE;

    *IF COMM22='99' THEN DELETE;

    *IF COMM31='99' THEN DELETE;

    *IF COMM32='99' THEN DELETE;

    *IF COMM41='99' THEN DELETE;

    *IF COMM42='99' THEN DELETE;

data ppptest2010;

    set ppptest2010;

VOL2 = ( 0.21099 + ( 0.00221 * (( AGE2D * AGE2D ) * AGE2HT ));

VOL3 = ( 0.21099 + ( 0.00221 * (( AGE3D * AGE3D ) * AGE3HT ));

VOL4 = ( 0.21099 + ( 0.00221 * (( AGE4D * AGE4D ) * AGE4HT ));

run;

*PROC SORT;

*BY BLOCK CLONE;

*PROC MEANS NOPRINT;

*BY BLOCK CLONE;

*VAR AGE1HT AGE2D AGE2HT AGE3D AGE3HT AGE4D AGE4HT VOL2 VOL3 VOL4;

*OUTPUT OUT=GENOTYPE MEAN=AGE1HT AGE2D AGE2HT AGE3D AGE3HT AGE4D AGE4HT VOL2 VOL3 VOL4;

PROC GLM;

CLASS BLOCK CLONE;

MODEL AGE1HT AGE2D AGE2HT VOL2 AGE3D AGE3HT VOL3 AGE4D AGE4HT VOL4=BLOCK CLONE BLOCK*CLONE;

LSMEANS BLOCK;

MEANS BLOCK/DUNCAN ALPHA=0.01;

LSMEANS CLONE;

MEANS CLONE/DUNCAN ALPHA=0.01;

RUN;

Dahcilsam
Calcite | Level 5

Thank you so much, problem is solved.

ballardw
Super User

No data step. The data step would start with DATA . The Proc Import creates a data set but does no manipulation of data and ends at the RUN;

Add code such as TLK suggested.

Rick_SAS
SAS Super FREQ

What TLK meant is that you need to put

data ppptest2010;

    set ppptest2010;

after the first RUN statment.  When SAS sees the RUN statement, it leave PROC IMPORT and waits for you to type a new DATA step or run a procedures (or issue global statements).  Those transformation statements are only valid inside of a DATA step. Otherwise, SAS doesn't know where to find the variables that you reference and where to put the variables that you create.

Dahcilsam
Calcite | Level 5

Thanks to you all. Problem solved.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1972 views
  • 5 likes
  • 4 in conversation