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 Read | 29 | ||
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
Hello @mona4u,
Your question requires more details before experts can help. Can you revise your question to include more information?
Review this checklist:
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.
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
.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.
combining the data sets is hard to me bc there is no matching to combine them
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
This is really helpful even though I'm still learning proc sql
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.