LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 1996, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 19 Nov 1996 07:57:00 EST
Reply-To:     "Kasperovic, Nicholas" <NKaspero@VITGCAB1.TELSTRA.COM.AU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Kasperovic, Nicholas" <NKaspero@VITGCAB1.TELSTRA.COM.AU>
Subject:      FW: Downloading Output - The code
Comments: To: SCOTT WILLETTE <SWILLETT@BCBSCT.COM>

Scott and SAS-l'rs,

Just to give an example how to generate Excel data on a m/frame for subsequent use on MS-Excel. I generally use TCP/IP to xfer info from the m/frame to PC. What you use is up to you.

Ensure that the filename on the pc has a .TXT extension. In MS-Excel, open the file as *.TXT, and you will find all the values loaded as required - easy.

Regards, Nick KASPEROVIC

SAMPLE CODE =========================================================================== ========= //userid JOB (A/c #),'N KASPEROVIC', // CLASS=A, // MSGCLASS=0, // NOTIFY=&SYSUID //********************************************************************** //S010SAS EXEC SAS //********************************************************************** //INDATA DD DISP=SHR,DSN=DPFCB.C822927.OPLIST //EXCELOP DD DSN=PROJX.userid.DATA,DISP=SHR //SASLIST DD SYSOUT=* //SYSIN DD *

OPTIONS NODSNFERR NOCENTER;

/******************************************************************** ** ** ** Short demonstration program to show how to generate an MX-EXCEL ** ** compatable file. No macros have been used. ** ** ** ** Author: Nick KASPEROVIC (Nybbles & Bytes Pty Ltd) ** ** ** ** Date: 18NOV96 ** ** ** ** There is no copyright on this program. Feel free to what you ** ** will. ** ** ** ********************************************************************/

DATA mine;

*--- Define lengths for variables ---; LENGTH country $ 15 state $ 30 capital $ 10 area 4 pop 4 ;

*--- Define output format for numeric variables ---; FORMAT area pop COMMA12.0;

*--- Assign output DDNAME (as defined in JCL) ---; FILE excelop;

*--- Read-in using free format required data ---; INPUT country & state & capital & area & pop;

*--- Quote (and trim) character fields ---; country = "'" ]] TRIM(country) ]] "'"; state = "'" ]] TRIM(state) ]] "'"; capital = "'" ]] TRIM(capital) ]] "'";

*--- Write/PUT results to output file ---; PUT country +(-1) '05'X state +(-1) '05'X capital +(-1) '05'X area +(-1) '05'X pop +(-1) ; *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% In the above, the +(-1) ensures no spaces in the output. %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%; CARDS; AUSTRALIA New South Wales Sydney 309500 5771900 AUSTRALIA Queensland Brisbane 666900 2834100 AUSTRALIA South Australia Adelaide 379900 451100 AUSTRALIA Tasmania Hobart 26200 451100 AUSTRALIA Victoria Melbourne 87900 4321500 AUSTRALIA Western Australia Perth 975000 1594700 AUSTRALIA Northern Territory Darwin 519800 156500 AUSTRALIA Austrlian Capital Territory Canberra 900 278700 ; /* =========================================================================== ========== >---------- >From: Kasperovic, Nicholas >Date: 18 November 1996 15:15 > >Scott wrote, > >>Hello all, >>Am new to the list (and SAS for that matter). I am looking to download >>SAS output onto a mainframe shared drive in order to import the results >>into Excel (and probably Access at some point). Can this be done? If >>so, any suggestions would be greatly appreciated. I am working with >>v6.08 on an MVS based mainframe platform. >>TIA >>Scott Willette > > Yes, it can be done. > > I prefer to quote all string variables and delimit other variables with a tab >('05'x). Some pundits will say use commas but I prefer tabs as delimiters (thereby >eliminating problems when processing >numbers with included commas or text with >commas). > > I presume you are going to down load data (from m/frame to PC) for processing. >Depending on your SAS skill level the following may/may-not be easy. > >Step 1 >===== > Output column headers at observation 1 (in quotes and delimited with a tab) >(eg):- >"Country" <tab> "State" <tab> "Area (Sq. Mls)" <tab> "Population" > >Step 2 >===== > Process observations until the end. >"Australia" <tab> "Victoria" <tab> 12,345,678 <tab>9,876,543 >"Australia" <tab> "Queensland" <tab> 123,456,789 <tab> 5,432,100 > ><etc> > > Using this process, it is merely a matter of downloading the flat file to the >PC filename with an extension of TXT and when you load it into MS Excel , it will >automatically look after itself. > >If you need code details, please let me know. > >Regards, >Nick KASPEROVIC >NKASPERO@VITGCAB1.TELECOM.COM.AU >Melbourne, AUSTRALIA


Back to: Top of message | Previous page | Main SAS-L page