[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: SAS Code
From:       xlr82sas <xlr82sas () AOL ! COM>
Date:       2010-02-28 17:23:40
Message-ID: 0b09ff78-007e-4699-b373-e8fcae3f304e () k5g2000pra ! googlegroups ! com
[Download RAW message or body]

On Feb 28, 9:10 am, mark <mark.chas...@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;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic