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

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