BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Steelersgirl
Calcite | Level 5

I have a data set that is currently a 3 by 160 table of movie reviews. The first row is numbers for the movie reviews. I want to separate the table in to 4 smaller tables with values 1-40 in the first table, 41-80 for the second table, etc. I also want to drop the first column of numbers from these tables. This is the code I am trying for the first table but it is not working.  

 

DATA movie;
FILENAME webpage URL 'http://people.stat.sc.edu/hitchcock/moviereview.txt';
INFILE webpage;
INPUT reviewnumber $ Siskel $ Ebert $;
DROP reviewnumber
RUN;

PROC PRINT DATA=movie;
WHERE reviewnumber CONTAINS BETWEEN 1 AND 40;
TITLE 'Quarter 1';
RUN;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

1) Can reviewnumber be non numeric ? why not read it as numeric, without the $ symbol ?

 

2) Assume reviewnumber is 1 - is it '1 ' or '01' or ' 1' ? 

3) Assume reviewnumber is 12 - does it contain 1 ?

 

I believe that changing the reviewnumber to numeric and check by

     " where reviewnumber between 1 and 40 "  instead using contain function - can solve the issue

otherwise post your log and explain what do you mean by "not working".

View solution in original post

1 REPLY 1
Shmuel
Garnet | Level 18

1) Can reviewnumber be non numeric ? why not read it as numeric, without the $ symbol ?

 

2) Assume reviewnumber is 1 - is it '1 ' or '01' or ' 1' ? 

3) Assume reviewnumber is 12 - does it contain 1 ?

 

I believe that changing the reviewnumber to numeric and check by

     " where reviewnumber between 1 and 40 "  instead using contain function - can solve the issue

otherwise post your log and explain what do you mean by "not working".

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 16. 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
  • 1 reply
  • 558 views
  • 0 likes
  • 2 in conversation