BookmarkSubscribeRSS Feed
harveysarah0
Calcite | Level 5

I am trying to merge 2 data sets: ribs and shrimp. I am getting this error message.

8 REPLIES 8
PaigeMiller
Diamond | Level 26

Many of us will not download attachments. Please just include the code and the error in your message.

--
Paige Miller
harveysarah0
Calcite | Level 5
DATA New-Dataset-Name (OPTIONS);
    MERGE Dataset-Name-1 (OPTIONS) Dataset-Name-2 (OPTIONS);
    BY Variable(s);
RUN;

 ERROR: Tables with 0 columns are not supported by this object. Work.BBQ cannot be opened. Do you want to select a different table to open? 

PaigeMiller
Diamond | Level 26

@harveysarah0 wrote:
DATA New-Dataset-Name (OPTIONS);
    MERGE Dataset-Name-1 (OPTIONS) Dataset-Name-2 (OPTIONS);
    BY Variable(s);
RUN;

 


This is not your actual code. We need to see the actual code that you ran which produced the error message.

--
Paige Miller
harveysarah0
Calcite | Level 5

data shrimp;
input City :$20. State :$3. Shrimp :$3.;
cards;
Baltimore MD Yes
Brooklyn NY No
Buffalo NY Yes
Harlem NY No
Newark NJ Yes
Rochester NY Yes
Stamford CT Yes
Syracuse NY Yes
Troy NY Yes
;
data ribs;
input City :$15. State :$2. Price;
cards;
Baltimore MD 10.95
Brooklyn NY 12.99
Buffalo NY 11.50
Harlem NY 12.50
Newark NJ 11.50
Rochester NY 10.95
Stamford CT 11.50
Syracuse NY 10.95
Troy NY 11.50
;
DATA BBQ Ribs (OPTIONS);
MERGE Ribs-1 (OPTIONS) Shrimp-2 (OPTIONS);
BY Variable(s);
RUN;

Reeza
Super User
It means one of your data sets is empty so it cannot be merged. My guess is you have an error in your process earlier at some point that was missed somehow.
harveysarah0
Calcite | Level 5

data shrimp;
input City :$20. State :$3. Shrimp :$3.;
cards;
Baltimore MD Yes
Brooklyn NY No
Buffalo NY Yes
Harlem NY No
Newark NJ Yes
Rochester NY Yes
Stamford CT Yes
Syracuse NY Yes
Troy NY Yes
;
data ribs;
input City :$15. State :$2. Price;
cards;
Baltimore MD 10.95
Brooklyn NY 12.99
Buffalo NY 11.50
Harlem NY 12.50
Newark NJ 11.50
Rochester NY 10.95
Stamford CT 11.50
Syracuse NY 10.95
Troy NY 11.50
;
DATA BBQ Ribs (OPTIONS);
MERGE Ribs-1 (OPTIONS) Shrimp-2 (OPTIONS);
BY Variable(s);
RUN;

Astounding
PROC Star

You have program pieces that are entirely illegal.

 

(OPTIONS)

 

Cannot be part of a DATA step.

 

Ribs-1

Shrimp-2

 

These are not the names of your data sets, nor would they be legal as data set names if you attempted to create them.

 

Variable(s)

 

You have to actually name the variables, not imagine that SAS can figure out the right variable names.  

 

This would be along the right lines:

 

DATA BBQ_Ribs;
MERGE Ribs Shrimp;
BY City State;
RUN;
Reeza
Super User

Here's a tutorial on merging data, it covers your use case.

https://stats.idre.ucla.edu/sas/modules/match-merging-data-files-in-sas/

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 8 replies
  • 667 views
  • 0 likes
  • 4 in conversation