BookmarkSubscribeRSS Feed
rishabhmehra13
Calcite | Level 5

Can you check upon this.

 


libname l '/folders/myfolders';
data carselect;
set l.permanent;

select(Manufacturer);
LENGTH country $200;
when("Honda","Lexus","Mitsubis","Infiniti") country = "Japan";
when("Hyundai") country=""SouthKorea";
when("BMW","Audi"," Mercedes") country = "germany";
when("Jaguar") country = "India";

when("Acura","Buick","Cadillac","Chevrole","Chrysler","Dodge","Ford","Jeep","Lincoln") country = "USA";

 

otherwise country = "other";
end;

run;

 

 

 

log

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 libname l '/folders/myfolders';
NOTE: Libref L was successfully assigned as follows:
Engine: V9
Physical Name: /folders/myfolders
57 data carselect;
58 set l.permanent;
59
60 select(Manufacturer);
61 LENGTH country $200;
62 when("Honda","Lexus","Mitsubis","Infiniti") country = "Japan";
63 when("Hyundai") country=""SouthKorea";
__
49
__________
388
76
64 when("BMW","Audi","Mercedes") country = "germany";
___ ______________ ________
49 49 49
65 when("Jaguar") country = "India";
______________ ________
49 49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
 
ERROR 388-185: Expecting an arithmetic operator.
 
ERROR 76-322: Syntax error, statement will be ignored.
 
66
67 when("Acura","Buick","Cadillac","Chevrole","Chrysler","Dodge","Ford","Jeep","Lincoln") country = "USA";
___ ___ ___ ___ ___ ___ ______________
_______________________
49 49 49 49 49 49 49 49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
 
68
69
70
71 otherwise country = "other";
72 end;
73
74 run;
75
76
77 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
78 ODS HTML CLOSE;
79 &GRAPHTERM; ;*';*";*/;RUN;
 
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CARSELECT may be incomplete. When this step was stopped there were 0 observations and 16 variables.
WARNING: Data set WORK.CARSELECT was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.07 seconds
 
79 ! QUIT;
 
80 QUIT;RUN;
81 ODS HTML5 (ID=WEB) CLOSE;
82
83 ODS RTF (ID=WEB) CLOSE;
84 ODS PDF (ID=WEB) CLOSE;
NOTE: ODS PDF(WEB) printed no output.
(This sometimes results from failing to place a RUN statement before the ODS PDF(WEB) CLOSE statement.)
85 FILENAME _GSFNAME;
NOTE: Fileref _GSFNAME has been deassigned.
86 DATA _NULL_;
87 RUN;
 
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
 
 
88 OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
89
2 REPLIES 2
mohamed_zaki
Barite | Level 11

@rishabhmehra13 wrote:

....
when("Hyundai") country=""SouthKorea";

....

 

 
Astounding
PROC Star

Yes, removing the extra quote will solve one of the problems.  But your syntax for SELECT statements is not valid.  Here is an abbreviated version of what you will need to change:

 

length country $200;

select;
when(Manufacturer in ("Honda","Lexus","Mitsubis","Infiniti")) country = "Japan";
when(Manufacturer in ("Hyundai")) country=""SouthKorea";
when(Manufacturer in ("BMW","Audi"," Mercedes")) country = "germany";

...

otherwise country = "other";
end;

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!

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
  • 2 replies
  • 984 views
  • 0 likes
  • 3 in conversation