The SAS Output Delivery System and reporting techniques

report from different variables in diff data sets

Accepted Solution Solved
Reply
Regular Contributor
Posts: 165
Accepted Solution

report from different variables in diff data sets

I want to produce a report which looks like this table I eliminate part of the table to make the explanations easier 

Readable time point= sum of varaiable2(which is in data set 2)- sum of variable1 (which is in data set 1)

time point read= sum of variable1 (which is in data set 1)

I want to create the report and I want to know if I can create new data set that contains macros of the computation 

then create proc report step to output it 

Please suggest to me the best way to do it 

  

 

  
Readable Time Points:8
  
Time Points Read29  
    
  
  

 


Accepted Solutions
Solution
‎03-15-2018 11:22 AM
Esteemed Advisor
Posts: 5,626

Re: report from different variables in diff data sets

Here is one of many ways to combine summary data from unrelated datasets

 

proc sql;

create view tallBoy as
select 
    name,
    height
from sashelp.class
where sex = "M"
having height = max(height);

create view bigCar as
select 
    make,
    model,
    weight
from sashelp.cars
where type = "Sedan"
having weight = max(weight);

quit;

data reportData;
merge tallBoy bigCar;
run;

proc print data=reportData; run;
         Obs     Name     Height       Make            Model         Weight

          1     Philip      72      Volkswagen    Phaeton W12 4dr     5399
PG

View solution in original post


All Replies
SAS Moderator
Posts: 69

Re: report from different variables in diff data sets [how to improve your question]

Hello @mona4u,


Your question requires more details before experts can help. Can you revise your question to include more information? 

 

Review this checklist:

  • Specify a meaningful subject line for your topic.  Avoid generic subjects like "need help," "SAS query," or "urgent."
  • When appropriate, provide sample data in text or DATA step format.  See this article for one method you can use.
  • If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition. Use the Photos button to include the image in your message.
    use_buttons.png
  • It also helps to include an example (table or picture) of the result that you're trying to achieve.

To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message.  From there you can adjust the title and add more details to the body of the message.  Or, simply reply to this message with any additional information you can supply.

 

edit_post.png

SAS experts are eager to help -- help them by providing as much detail as you can.

 

This prewritten response was triggered for you by fellow SAS Support Communities member @Reeza

.
Super User
Posts: 13,941

Re: report from different variables in diff data sets

Why do you think you need macros? Macro of what computation?

 

Likely it is easier to create a DATASET combining the two existing data sets, doing some computation there and then using proc report for the output (though your example looks like TABULATE might be cleaner that Report).

 

Actual example INPUT data sets and desired output would help.

Regular Contributor
Posts: 165

Re: report from different variables in diff data sets

combining the data sets is hard to me bc there is no matching to combine them 

Solution
‎03-15-2018 11:22 AM
Esteemed Advisor
Posts: 5,626

Re: report from different variables in diff data sets

Here is one of many ways to combine summary data from unrelated datasets

 

proc sql;

create view tallBoy as
select 
    name,
    height
from sashelp.class
where sex = "M"
having height = max(height);

create view bigCar as
select 
    make,
    model,
    weight
from sashelp.cars
where type = "Sedan"
having weight = max(weight);

quit;

data reportData;
merge tallBoy bigCar;
run;

proc print data=reportData; run;
         Obs     Name     Height       Make            Model         Weight

          1     Philip      72      Volkswagen    Phaeton W12 4dr     5399
PG
Regular Contributor
Posts: 165

Re: report from different variables in diff data sets

This is really helpful  even though I'm still learning proc sql 

☑ This topic is solved.

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

Discussion stats
  • 5 replies
  • 185 views
  • 1 like
  • 4 in conversation