DATA Step, Macro, Functions and more

Error when merging data sets

Accepted Solution Solved
Reply
Regular Contributor
Posts: 216
Accepted Solution

Error when merging data sets

Hi

When I run the below data step to merge two data sets, I am getting the below errors for missing columns. However, both columns exist on both data sets. Is there something syntax-wise wrong? I have also sorted both data sets prior to running the merge.

Paul

ERROR: BY variable cnty_name is not on input data set WORK.S1AGESHORTYEARFREQSORT.

ERROR: BY variable startyear is not on input data set WORK.S1AGESHORTYEARFREQSORT.

data s1ageyear1;

merge work.s1ageshortyearfreqsort (keep=count rename=(count=cohortyearcount)) work.s1ageshorttestsort;

by cnty_name startyear;

run;


Accepted Solutions
Solution
‎11-13-2012 08:50 AM
Respected Advisor
Posts: 2,655

Re: Error when merging data sets

I am sure you will get better answers than this, but I think that keep=count statement has the result of only the variable 'count' being available for the merge.

Steve Denham

View solution in original post


All Replies
Solution
‎11-13-2012 08:50 AM
Respected Advisor
Posts: 2,655

Re: Error when merging data sets

I am sure you will get better answers than this, but I think that keep=count statement has the result of only the variable 'count' being available for the merge.

Steve Denham

PROC Star
Posts: 7,363

Re: Error when merging data sets

: I don't think he'll get a better answer than the one you provided!

Regular Contributor
Posts: 216

Re: Error when merging data sets

That was it, thanks.

Paul

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 173 views
  • 0 likes
  • 3 in conversation