BookmarkSubscribeRSS Feed
Liej
Calcite | Level 5

Hey guys,

I was wondering if there's a solution for my problem.

I need to create a lot of excel-files, more then 300, based on SAS-data.

There's an extra difficulty, the data in the excel-files need to be displayed

in a specific way.

This is the code I use to create my excel-files. (attachment)

The only problem I have is that the excel-files are created on the SAS-server.

Can I change my code so the excel-files are created on my PC or a shared folder?

David

4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12

Enterprise Guide is a client-server architecture.  When you run SAS PROCs, they are run on the server and can only get to directories known to that server.  There is a work-around to copy the files back to your PC.  See

There and back again: copying files in SAS Enterprise Guide - The SAS Dummy

Doc Muhlbaier

Duke

Liej
Calcite | Level 5

I made a little pdf-print from an excel-file example.

The green fields I need to take from a SAS-dataset and the blue fields are

calculated.

Is there an easier way to make such an excel-file with a lay-out like that

based on a SAS-dataset?

Cynthia_sas
SAS Super FREQ

Hi:

  Does PROC REPORT create the worksheet that you show? If you are already using PROC REPORT, then using a user-defined format and/or CALL DEFINE techniques, you could apply the colors and font changes to your output.

  Without getting into CALL EXECUTE, here's a simple PROC REPORT that does highlighting on the report rows based on variable values.

cynthia


proc format;
  value agef 11-12='yellow'
             13-14='cyan'
             15-16='cxdddddd';
run;
 
ods tagsets.excelxp file='c:\temp\hilite.xls' style=meadow;
 
proc report data=sashelp.class nowd;
title 'Highlighting Conditionally';
column name age height weight sex;
define name / order;
define age / display
        style(column)={background=agef.};
define height / display;
define weight / display;
define sex / display;
compute sex;
   if substr(name,1,1) = 'J' and
      sex = 'F' then do;
      call define('name','style','style={background=pink}');
      call define(_col_,'style','style={background=pink}');
   end;
   else if substr(name,1,1) = 'J' and
      sex = 'M' then do;
      call define('name','style','style={background=lightblue}');
      call define(_col_,'style','style={background=lightblue}');
   end;
  endcomp;
  compute height;
    ** color height based on age;
    colorval = put(age,agef.);
    call define (_col_,'style','style={background='||trim(colorval)||'}');
  endcomp;
run;
ods tagsets.excelxp close;
    

Liej
Calcite | Level 5

The worksheet showen in the pdf is created in Excel, and that's how the SAS-output should be. (fische excel.xls)

I don't need to have colors in my output, it was only to indicate the different type of fields.

Green fields are data taken from SAS, blue field are calculated and the white fields are tekst.

The excel-file is based on a SAS-dataset like this table. The data is sorted based on Number (asc) and

Start_date (desc).

NumberStart_dateDate_FinCode_1Code2
1234501-06-201230-06-2012764
1234501-05-201231-05-2012855
1234501-04-201230-04-2012804
1234501-03-201231-03-2012835
1234501-02-201229-02-2012793
1234501-01-201231-01-2012814
4567801-05-201230-06-2012806
4567801-03-201230-04-2012795
4567801-01-201229-02-2012837
7891201-06-201230-06-2012805

Based on this table I should create 3 excel-files  IFI_12345, IFI_45678 and IFI_78912.

Can I do this with Proc Report or should I keep using the call execute?

temp.xml is an example created with the call execute methode. As you can see there is no layout.

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!

Discussion stats
  • 4 replies
  • 1548 views
  • 6 likes
  • 3 in conversation