BookmarkSubscribeRSS Feed
plkkw
Calcite | Level 5

i have tables which is able to support mulitiple languages for product:

t1_product (
  t1_seq number,
  t1_attr1 varchar2(100),
  t1_attr2 varchar2(100),
  t1_attr3 varchar2(100),
  t1_attr4 varchar2(100),
  t1_attr5 varchar2(100)
);
create unique index t1_product(t1_seq)

t1_product_desc (
  t1_seq number,
  t1_lang varchar2(2), -- should be en, ch,
  t1_attr1_desc varchar2(100),
  t1_attr2_desc varchar2(100),
  t1_attr3_desc varchar2(100),
  t1_attr4_desc varchar2(100),
  t1_attr5_desc varchar2(100)
);
create unique index t1_product_desc(t1_seq, t1_lang);


user request to create a report but the column in the report doesn't show t1_product_desc.t1_attr1_desc (because

different product have different number of attribute. The column name is meaningless to users, even changing column

name in information map cannot satisfy the requirement).
I have a question that whether sas report (or used stored process) is able to show the "value" of

t1_product_desc.t1_attr1_desc as a column. therefore, we can use the "value" of t1_product_desc.t1_attr1_desc as

report section (or group)

e.g.

For PC, the attribute 1,2,3
CPU, RAM, Harddisk
For notebook, the attribute 1,2
body, RAM


The report should be:

PC (section or group level)
====================
                inventory required
CPU                 100
RAM                 300
harddisk               100


Notebook (section or group level)
====================
           inventory required
body            100
RAM            300

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  The kind of "recode" you describe where numbers will be translated to a character string is certainly possible with PROC FORMAT.

  The code below doesn't use formatting, but otherwise, shows a report similar to the one you described.

cynthia

ods html file='c:\temp\dogroups.html' style=sasweb;

proc report data=sashelp.shoes nowd;

  title 'Ordered by Region';

  column region product inventory;

  define region / group;

  define product / group;

  define inventory / sum;

  break after region / page summarize;

 run;

ods html close;

plkkw
Calcite | Level 5

Hi Cynthia,

Does it mean that simple "drag and drop" in Web report studio is not able to achieve my task?

Also, would you mind to tell me your table strucutre (column) and sample data?

Cynthia_sas
SAS Super FREQ

Hi: 

  To see the structure of SASHELP.SHOES, run a PROC CONTENTS, optionally followed by a PROC PRINT. The PROC CONTENTS will show you the variable names and labels and the PROC PRINT will show you the unsummarized data. You probably only need to show Africa and Asia regions to get an idea of what the original data looks like:

ods html file='c:\temp\shoesinfo.html';

proc contents data=sashelp.shoes;

  title 'proc contents';

run;

     

proc print data=sashelp.shoes;

  where region in ('Africa', 'Asia');

  var region product inventory sales returns subsidiary;

  title 'Print of Selected Obs';

run;

ods html close;

  As for your other question about drag and drop in Web Report Studio, I'm not sure I understand your task or data well enough to say. If a user-defined format is associated with a variable or column, then Web Report Studio can display that formatted value and you should be able to display the formatted values on the report. But, the formats would have to be defined in the metadata and the formats would have to be associated with te variable before WRS would be able to use the formats.

  I don't have a clear picture of what your data looks like from your description. I don't understand how your t1_product_desc.t1_attr1_desc column is used on the report. When I posted PROC REPORT code, I was thinking stored process, not Web Report Studio. When I think stored process, I think code, not drag and drop in the WRS report designer.

  You might want to work with Tech Support on this, if, in fact, your question is how to do what you want within the confines of WRS, but not with a stored process. There IS a lot you can do with code, but without understanding what your data actually looks like, it's hard to come up with an equivalent example. Tech Support can  look at your REAL data and help you come up with either an info map/WRS solution or a stored process solution.

cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1545 views
  • 0 likes
  • 2 in conversation