BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mona4u
Lapis Lazuli | Level 10

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  
    
  
  

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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

5 REPLIES 5
Community_Guide
SAS Moderator

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

.
ballardw
Super User

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.

mona4u
Lapis Lazuli | Level 10

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

PGStats
Opal | Level 21

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
mona4u
Lapis Lazuli | Level 10

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

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
  • 5 replies
  • 861 views
  • 1 like
  • 4 in conversation