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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 662 views
  • 0 likes
  • 2 in conversation