Bill,

Here is a snippet of code where I use the data processed by a CROSSTAB to
populate a table in a grid format.  In this example I am creating a grid
with shoe sizes as columns, shoe widths as rows and the cell data is the
authorized stocking qty..  Once you create the temporary table from the
CROSSTAB data, you can UNLOAD it as a CSV file.

DROP TABLE asq_grid

CREATE TEMPORARY TABLE asq_grid +

h1 TEXT 8,H2 TEXT 4,S1 TEXT 8,S2 TEXT 8,S3 TEXT 4,S4 TEXT 4,S5 TEXT 4,S6 +

TEXT 4,S7 TEXT 4,S8 TEXT 4,S9 TEXT 4,S10 TEXT 4,S11 TEXT 4,S12 TEXT 4,S13 +

TEXT 4,S14 TEXT 4,S15 TEXT 4,S16 TEXT 4,S17 TEXT 4,S18 TEXT 4,S19 TEXT 4, +

S20 TEXT 4,S21 TEXT 4,S22 TEXT 4,MFG_STYLE TEXT 12

SET ZERO OFF

--CROSSTAB creates data 

OUTPUT shoe_grid.dat

CROSSTAB SUM auth_qty FOR mfg_size BY mfg_width FROM upc_master +

WHERE mfgcode = .vMFG AND mfg_style = .vMFG_STYLE

OUTPUT SCREEN

--Load the table with the data processed by the CROSSTAB

LOAD asq_grid FROM shoe_grid.dat AS ASCII

--At this point you could do an UNLOAD as CSV to create your CSV file

John

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Niehaus
Sent: Tuesday, November 11, 2008 1:01 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - CROSSTAB followup

 

Thanks Albert.  I've never used CROSS TAB before.  It seems pretty
efficient. 

 

Is there a way to get the output from CROSSTAB into something like a CSV
file?

 

Bill

>>> Albert Berry <[EMAIL PROTECTED]> 11/11/2008 12:50 AM >>>
Bill, that looks like a crosstab to me.

CROSSTAB AVG(Sugar) FOR Rep BY Trial
Note that AVG or MAX or MIN will work just fine.

Bill Niehaus wrote:
> I am trying to generate a transposed view on rows in a table.
>  
> The table contains data like:
>  
> Trial   Rep   Sugar
>  81      1     15
>  81      2     14
>  81      3     16
>  81      4     15
>  81      5     14
>  81      6     16
>  82      1     13
>  82      2     12
>  82      3     14
>  82      4     15
>  82      5     11
>  82      6     15
>  
>  
>  I want to generate a view with rows with data arranged like:
>  
> Trial  SugarRep1  SugarRep2  SugarRep3  SugarRep4  SugarRep5  SugarRep6
>  81       15         14        16         15         14         16
>  82       13         12        14         15         11         15
>  
>  
>  I am not trying to do any calculations in R:Base, but just want to 
> eventually
>  get the data into ASCII or Excel files for sending to a different 
> program.
>  
>  Thanks.
>  
>  Bill
>  
>  

--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: 
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, 
place any 
text to search for.
================================================



Reply via email to