BookmarkSubscribeRSS Feed
MarySasbegginer
Calcite | Level 5

Using the SAS data set Bicycles, create two temporary SAS data sets as follows: Mountain_USA consists of all observations from Bicycles where Country is USA and Model is Mountain Bike. Road_France consists of all observations from Bicycles where Country is France and Model is Road Bike. Print these two data sets.

 

here is my code what am i doing wrong?

data Mountain_USA;
set '/home/u62245181/Today/bicycles.sas7bdat';
where Country = "USA" and Model = "Mountain_Bike";
run;

4 REPLIES 4
Tom
Super User Tom
Super User

And what happens when you run it?  Do you get error messages?  If it works how is the result different than you expected.

 

Does the value of MODEL include the underscore you used in the code? Or the space you used in your description?

PaigeMiller
Diamond | Level 26

@MarySasbegginer 

 

When you have code that isn't working, SHOW US the log (we need to see the ENTIRE log for this DATA step, not parts of the log).

--
Paige Miller
MarySasbegginer
Calcite | Level 5
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 data Mountain_USA;
70 set clean.'/home/u62245181/Today/bicycles.sas7bdat';
______
22
201
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,
NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.
 
ERROR 201-322: The option is not recognized and will be ignored.
 
71 run;
 
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MOUNTAIN_USA may be incomplete. When this step was stopped there were 0 observations and 6 variables.
WARNING: Data set WORK.MOUNTAIN_USA was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 902.09k
OS Memory 24488.00k
Timestamp 10/10/2022 10:05:40 PM
Step Count 30 Switch Count 1
Page Faults 0
Page Reclaims 120
Page Swaps 0
Voluntary Context Switches 8
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 16
 
 
72 where Country = "USA" and Model = "Mountain_Bike";
_____
180
 
ERROR 180-322: Statement is not valid or it is used out of proper order.
 
73 run;
74
75 title "USA models";
76 proc print data=Mountain_USA noobs;
77 run;
 
Tom
Super User Tom
Super User

That is NOT the code you originally posted.  Can you see the difference?

Spoiler
set clean.'/home/u62245181/Today/bicycles.sas7bdat';
set '/home/u62245181/Today/bicycles.sas7bdat';

You can either reference the data with a quoted physical filename such as one of these :

set '/home/u62245181/Today/bicycles.sas7bdat';
set '/home/u62245181/Today/bicycles';

Or you can create a libref pointing to the directory and use normal SAS syntax instead.

libname clean '/home/u62245181/Today' ;
....
set clean.bicycles;
...

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 521 views
  • 1 like
  • 3 in conversation