BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
septemberbulb
Obsidian | Level 7

Hello,

 

I want to combine two dataset: PL and PLC vertically,

so I use the

data all;

set PL PLC;

run;

 

I hope the output will show: a title for PL and a title for PLC in one dataset , does anyone know how and where can I add that please?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Titles don't exist within a dataset, only for reports. 

 

Look at Example 2

 

https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p10gcmrmf83iax...

 

You will need a variable to differentiate the datasets, look at the INDSNAME option to capture the name of the dataset. 

 

Data all;

length source dsname $50.;

set pl plc INDSNAME=source;

dsname=source;

run;

View solution in original post

3 REPLIES 3
Reeza
Super User

Titles don't exist within a dataset, only for reports. 

 

Look at Example 2

 

https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p10gcmrmf83iax...

 

You will need a variable to differentiate the datasets, look at the INDSNAME option to capture the name of the dataset. 

 

Data all;

length source dsname $50.;

set pl plc INDSNAME=source;

dsname=source;

run;

Astounding
PROC Star

Reeza's tools can help, but you may need some programming as well.  You may need to add a variable to the data set that holds the text you want to insert into the title (possibly the entire text, as in this example below).

 

data want;

set PL (in=in1) PLC (in=in2);

length title_text $ 50;

if in1 then title_text = 'I want to use this title for the PL observations';

else title_text = 'Exceptions were also added by the PLC observations';

run;

 

Then you can use this text as titles by adding a BY statement and #BYVAL:

 

proc print data=want;

by title_text notsorted;

title '#BYVAL1';

run;

 

So SAS isn't really built to do what you ask, but you can work around that even without using ODS.

septemberbulb
Obsidian | Level 7
thank you. learned a lot

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 2767 views
  • 1 like
  • 3 in conversation