BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

What is the purpose of TEST3?  Wouldn't it make more sense to get the list of ALL years from test2?

select distinct break as name,year from test2
union
select distinct "ALL" as name,year from test2
rkarr5
Calcite | Level 5

Hey Tom,

 

The issue here is data step will update the value to All when ever it encounters the test3 dataset, But my requirement is after it gets all the data from both the datasets, it should append all value and the year for distinct years in test3 dataset.

 

 

Tom
Super User Tom
Super User

@rkarr5 wrote:

Hey Tom,

 

The issue here is data step will update the value to All when ever it encounters the test3 dataset, But my requirement is after it gets all the data from both the datasets, it should append all value and the year for distinct years in test3 dataset.

 

 


Not sure why you would need to use "record" pointers to do that in your existing database. Doesn't it support normal basic SQL code?

create table want as 
  select distinct x,y from source1
;
insert into want 
  select distinc 'ALL' as X, Y from source2
;

I still think that it looks like your overall goal is to summarize data and PROC SUMMARY is a great tool to do that.

rkarr5
Calcite | Level 5

Thanks Tom. Will check this code. I will try to explore proc summary also.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 18 replies
  • 1745 views
  • 4 likes
  • 3 in conversation