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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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