From: mark on 28 Feb 2010 12:10 Hello , I used the code - DATA home; INFILE 'c:\Cwa\Home.txt'; INPUT Owner $ 1-7 Description $ 9-33 Cost; IF Cost=. THEN CostGroup='missing'; ELSE IF Cost<2000 THEN CostGroup='low' ELSE IF Cost<10000 THEN CostGroup='medium'; ELSE CostGroup='high'; PROC PRINT DATA=home; TITLE 'Home Improvement Cost Groups'; RUN; The log - 185 ELSE IF Cost<10000 THEN CostGroup='medium'; ---- 388 76 ERROR 388-185: Expecting an arithmetic operator. ERROR 76-322: Syntax error, statement will be ignored. 186 ELSE CostGroup='high'; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.HOME may be incomplete. When this step was stopped there were 0 observations and 4 variables. WARNING: Data set WORK.HOME was not replaced because this step was stopped. kindly guide, mark
From: xlr82sas on 28 Feb 2010 12:23 On Feb 28, 9:10 am, mark <mark.chas...(a)yahoo.in> wrote: > Hello , > > I used the code - > > DATA home; > INFILE 'c:\Cwa\Home.txt'; > INPUT Owner $ 1-7 Description $ 9-33 Cost; > IF Cost=. THEN CostGroup='missing'; > ELSE IF Cost<2000 THEN CostGroup='low' > ELSE IF Cost<10000 THEN CostGroup='medium'; > ELSE CostGroup='high'; > PROC PRINT DATA=home; > TITLE 'Home Improvement Cost Groups'; > RUN; > > The log - > > 185 ELSE IF Cost<10000 THEN CostGroup='medium'; > ---- > 388 > 76 > ERROR 388-185: Expecting an arithmetic operator. > > ERROR 76-322: Syntax error, statement will be ignored. > > 186 ELSE CostGroup='high'; > > NOTE: The SAS System stopped processing this step because of errors. > WARNING: The data set WORK.HOME may be incomplete. When this step was > stopped there were 0 > observations and 4 variables. > WARNING: Data set WORK.HOME was not replaced because this step was > stopped. > > kindly guide, > mark You are missing a semicolon after 'low'. DATA home; cost=2500; IF Cost=. THEN CostGroup='missing'; ELSE IF Cost<2000 THEN CostGroup='low'; ELSE IF Cost<10000 THEN CostGroup='medium'; ELSE CostGroup='high'; run; PROC PRINT DATA=home; TITLE 'Home Improvement Cost Groups'; RUN;
|
Pages: 1 Prev: how to prevent SAS macro from interpreting "&" Next: area under the curve |