Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Trying to generate an HTML file using SAS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Tue Apr 28, 2009 4:05 pm    Post subject: Trying to generate an HTML file using SAS
Reply with quote

I am trying to generate an HTML file using SAS.
Code is as following -
%macro reprt1;
data _null_ ;
ODS HTML FILE="C:\sasout.htm";
put '<HTML>';
put '<HEAD>';
put '<BODY>';
put 'testing SAS - HTML output'
put '</BODY>';
put '</HEAD>';
put '</HTML>';
ODS HTML CLOSE;
run;
%mend reprt1;
%reprt1;

The HTML file is not getting created. Tried a lot of other options. Not working. Can someone pls help.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 28, 2009 5:06 pm    Post subject:
Reply with quote

Which version of SAS are you using? What error messages does SAS generate when you attempt to create c:\sasout.htm? Are you sure there's no sasout.htm file being created -- or did it create one that has invalid HTML code in it? Have you read the SAS Output Delivery System User's Guide? If not, acquire a copy of it and start reading.

With all recent versions of SAS (from about 8.2 IIRC), all you have to say is
Code:
ODS HTML FILE="..." ;
PROC PRINT;
ODSS HTML CLOSE;
The tags are all automatically generated by SAS and putting them in your code, the way you show, is not only not required but will force HTML errors that would prevent the display of the HTML document.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 28, 2009 5:17 pm    Post subject:
Reply with quote

Also, as posted your code has an error:
Code:
put 'testing SAS - HTML output'
does not have the trailing semicolon that it needs.
Back to top
View user's profile Send private message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Tue Apr 28, 2009 5:22 pm    Post subject:
Reply with quote

Am using Version 8.2
It gives the following error -
"ERROR: Invalid file, C:\SASOUT.HTM."

Actually, i did a full search...it is creating an internet shortcut..
When i try to open it gives the following message -
"file:///C:/SASHTML.htm The specified path does not exist..
Not sure why this is happening...

ok u mean to say that i need to include only the required data in the code...and the tags will be automatically generated?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 28, 2009 5:33 pm    Post subject:
Reply with quote

Okay, fixing the syntax errors, you should try this:
Code:
data x;
testvar = 'testing SAS - HTML output';
output;
ODS HTML FILE="C:\sasout.htm";
proc print data=x;
run;
ODS HTML CLOSE;
The RUN; has to be before the ODS HTML CLOSE for it to generate the HTML correctly. I took out the tags you don't need -- because SAS will generate them for you. Also note that the ODS HTML FILE= format is used with PROC output -- not DATA steps. The syntax for using ODS HTML with DATA steps is very much different and you'll need to read the manual to see what is needed.
Back to top
View user's profile Send private message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Tue Apr 28, 2009 5:42 pm    Post subject:
Reply with quote

Ok fine...
tried that..
now what is happening is...its showing the text 'testing SAS - HTML output' in the SASLIST..however in SASLOG its still giving the following error ..
"ERROR: Invalid file, C:\SASOUT.HTM.
ERROR: Invalid file, C:\SASOUT.HTM.
ERROR: Invalid file, C:\SASOUT.HTM.
WARNING: No body file. HTML output will not be created.
ERROR: Errors printed on page 1.
ERROR: Errors printed on page 1.
ERROR: Errors printed on page 1." and the file is not getting created..

Any idea what this implies... "No body file."
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 28, 2009 5:52 pm    Post subject:
Reply with quote

Where are you running the SAS code? And post the exact code you're using now (in BBcode format).
Back to top
View user's profile Send private message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Tue Apr 28, 2009 6:06 pm    Post subject:
Reply with quote

I'm running MainframeSAS...not PC SAS...
and i ran the exact code which u specified...The SAS has just that..its within a macro..as follows-

%macro reprt1;
data x;
testvar = 'testing SAS - HTML output';
output;
ODS HTML FILE="C:\sasout.htm";
proc print data=x;
run;
ODS HTML CLOSE;
%mend reprt1;
%reprt1;
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 28, 2009 6:29 pm    Post subject:
Reply with quote

1. Mainframe SAS requires you to build an output file on the mainframe. c:\sasout.htm has 2 characters not valid for mainframe file names (the colon and the backslash) and the first name level is 9 characters while the limit is 8. Change your name to something valid on your mainframe.
2. My code was written and tested using PC SAS since I assumed from the file name that you were using PC SAS. However, there is one big difference between my code and your code. Your code has a macro definition and invocation; mine does not. Your code is not what I asked you to test.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 28, 2009 8:25 pm    Post subject:
Reply with quote

After doing some research, I found TS-664 on the SAS web site which says
Quote:
A DATA Stepper’s Introduction to ODS
As awareness of the Output Delivery System (ODS) becomes more widespread, I am frequently asked if existing DATA _NULL_ code can simply be wrapped in ODS statements to create ODS style output. While this is a straightforward question, the answer is not.
You should read this paper for sure, and probably browse the ODS manual in more detail. There may be more on the SAS web site about ODS and DATA steps but that's what I found in a brief look.
Back to top
View user's profile Send private message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Wed Apr 29, 2009 10:24 am    Post subject:
Reply with quote

Ookk..
Fine..am reading through the paper...
Also, i want to know the difference between PC SAS and Mainframe SAS. Do u know of any good reference docs which i can go thru..

And...created the mainframe file..the HTML tags are all getting generated in that dataset...but now i dont know what to do next.. icon_confused.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Wed Apr 29, 2009 5:06 pm    Post subject:
Reply with quote

PC SAS and Mainframe SAS differ (1) in the platform they run on, (2) platform specifics (file allocation and assignment, numeric characteristics, and so forth), and (3) PC SAS uses a GUI interface that mainframe SAS doesn't support. Allowing for the platform differences, SAS code on a mainframe will run on a PC just fine. Check the SAS web site for their documentation -- they've got a manual for z/OS, one for Windows, and one for Unix boxes.

OK -- you've generated the HTML file. What were you planning on doing with the file? That tells you what to do next. Depending on your requirements, you may need to download the file to a server, download the file to a PC, or look at it directly on the mainframe (which requires knowing how your browser interacts with the mainframe).
Back to top
View user's profile Send private message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Thu Apr 30, 2009 3:39 pm    Post subject:
Reply with quote

The task that i'm working on...requires a web page to be generated which contains some reports..the data for which is taken from the mainframe SAS datasets...the code for generating the same is also done in Mainframe SAS..
I have right now managed to generate a mainframe dataset that contains the HTML tags..bt now i want to use this to create a .html file in the windows operating system..can that be done...?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Thu Apr 30, 2009 5:22 pm    Post subject:
Reply with quote

Do you have a server running Windows that you can transfer the html file to? Servers run different software than desktops, so you cannot (unless your site is extremely unusual) FTP the file from your mainframe to your desktop.

Contact your site support group and find out if IBM'S HTTP server is running on the mainframe. If so, have them establish a Unix System Services directory for your report files -- they may allocate an HFS or zFS file system and mount on a directory, depending on how big the reports are. Also have them update the HTTP web server configuration file to allow access to this directory (it needs a PASS directive to your directory). Change your SAS program to output to a file in that directory (which will be something like):
Code:
ODS HTML FILE='/usr/zerlina/reports/043009.html';


Once this has been done, on your desktop you can enter into your browser
Code:
http://<mainframe name or ip>/usr/zerlina/reports/043009.html
and your report will show up on your desktop in the browser.
Back to top
View user's profile Send private message
zerlina

New User


Joined: 27 Aug 2008
Posts: 7
Location: Pune

PostPosted: Tue May 05, 2009 8:24 pm    Post subject:
Reply with quote

i got PC SAS access...so now what i'm trying to do now is logon remotely to Mainframe from PC SAS...
Used the foll code-
%macro tcp;
%global mvs;
%let mvs = ibm3;
options remote = mvs;
filename rlink 'C:\Program Files\SAS Institute\SAS\V8\connect\saslink\logtso.scr';
%put NOTE: SAS/CONNECT configured for a Mainframe signon.;
SIGNON mvs;
%mend;
%tcp;

Getting the following error message -
ERROR: No data center network screen.
ERROR: A communication subsystem partner link setup request failure has occurred.
ERROR: Communication script processing aborted.
ERROR: Remote signon to MVS cancelled.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue May 05, 2009 8:44 pm    Post subject:
Reply with quote

You will probably need to work with your site SAS support representative to resolve this. It sounds like a configuration issue between your SAS PC session and your mainframe; there are so many potential stumbling blocks (for example, SAS configuration options on the PC, SAS configuration options on the mainframe, TCP/IP configuration options on the mainframe, router firewall issues) that only your site support group is going to be able to help you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us