BookmarkSubscribeRSS Feed
Pandu2
Obsidian | Level 7
Hi All,
I hope you're all doing Good.
I require some assistance from you all on achieving. Any help would be appreciated. Thankyou.
I've 3 tables data which has some count individually. I would like to take all these 3 tables count and put them into a new table. And the values in that new table should like
Without any headers. For an instance. The 1st table has 123 rows so it should be placed in new table like this.

123 - total purchases done.
And the 2nd table has 530 rows so it should be placed in new table like this.

530 - total new products.

And the 3rd table has 90 rows so it should be placed in new table like this.

90 - total old products using barcode.
Finally, the final table should have 3 tables rows count and some comments which I mentioned above seperated with hiphen (-). And the also in final table each value should have atleast 2 rows gap which is like this.

123 - total purchases done

530 - total new products

90 - total old products using barcode.

For your information, those 3 tables rows count will be changed daily wise as they gonna be updated daily and the rows in them aren't permanent they keep on changing on daily run.
8 REPLIES 8
ballardw
Super User

Example data should be in the form of data step code. 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.

 

By table do you mean a data set or a report that people read?

Kurt_Bremser
Super User

So you basically want to append the observation counts of three datasets with the dataset labels?

 

The strings that you posted are not valid as dataset names.

Pandu2
Obsidian | Level 7
Yes the observations count of three datasets into a new dataset but not with dataset labels. In that new dataset the values format should be mentioned above
1st dataset obs count - mentioned text
Likewise 2nd and 3rd datasets obs count alongside mentioned text separated with hiphen -
Thankyou.
Tom
Super User Tom
Super User

So you want to make a REPORT that has three observations and one variable?

 

You could use PROC SQL.

Let's assume your three datasets are named  A, B and C.

proc sql;
select 1 as order,catx(' - ',count(*),'total purchases done.') as message from A
union
select 2 as order,catx(' - ',count(*),'total new products.') as message from B
union
select 3 as order,catx(' - ',count(*),'total old products using barcode.') as message from C
order by order
;

 

Pandu2
Obsidian | Level 7
Yes, it's quite similar to report but I would like to put that info in an already existing excel file named purchases in a new sheet. That's my main motto.
Tom
Super User Tom
Super User

Stuffing dynamic data into an existing EXCEL file is not really a workable idea.

You could update a data sheet in the EXCEL file and then have the pretty reporting sheet populate the values from that data sheet.

 

Or produce the full report using your SAS program.

Pandu2
Obsidian | Level 7
In your code, does the count changes whenever the 3 tables are updated?. Please let me know. Thankyou.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 875 views
  • 0 likes
  • 4 in conversation