BookmarkSubscribeRSS Feed
BenBrady
Obsidian | Level 7

I have a reference table that displays how my industries are grouped into sectors , and what has to go in each of the charts. The reference table looks as such:

ClusterSectorIndustry1Code1industry2code2Table_num_per_sectorchart_title
RWCP  Pharmacy Sales 61241test1
AAGAg nfd010  4test8
AAGMush012  4test8
AAGFruit013  4test8

 

I want to reference this table and output csv files. The data set I will perform the analysis on is this: 

 

codeyearindustryemp
0102008Ag nfd1
0102009Ag nfd2
42008B2
42009B2
0122008Mush1
0122009Mush2
0132009Fruit3
61242008Pharmacy Sales 2
61242009Pharmacy Sales 4

 

I want to use the reference table to go through this data set and output csv files like this (for example).

 

CSV1: Called test1

 

yearPharmacy Sales
20082
20094

 

CSV2: called test8

yearAg nfdMushFruit
2008110
2009223

 

It is important to note how the outputed csv's are called what they are told to from the reference table, and that missing values such as 2009 for Fruit are given a value of 0. Code1,Code 2 and industry1,industry2  in the reference table are to be compared with code and industry in the dataset that will be analysed.

 

I am wandering how to go about doing this. As I am working on a data set similar to this but on a bigger scale.

1 REPLY 1
ballardw
Super User

You might need to supply a little more detail on exactly HOW your reference table is used. Since the "analysis" you show is different then that tells me that the rows of the reference are used differently. Without a clue as to what may be wanted how to use your reference table is not obvious.

 

Call execute can be used with a data set to conditionally generate code, if you know which code you want. If you do not know which code you want then that is an entirely different set of questions.

 

We would need to know the purpose and possibly more values for each of the variables in the reference data set and then the type of "analysis" for each csv, especially if it is anything more than selecting records from the data set.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 748 views
  • 0 likes
  • 2 in conversation