BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GreggB
Pyrite | Level 9

I want to learn how to export html files to our organization's website. Is this the documentation I should use?

 

https://documentation.sas.com/api/docsets/pcfsicg/9.4/content/pcfsicg.pdf?locale=en

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Panagiotis
SAS Employee

Quick question, your subject says importing/exporting CSV files but your question says exporting HTML. I answered them both, I wasn't sure which you wanted.

 

1. If you want to import/export CSV files the easiest is to proc import and proc export

 

Quick example of proc import

proc import datafile="Location/of/file.csv"
		dbms=csv
		out=SASoutputTableName/*Creates the SAS table from the CSV file*/
		replace /*If out table exists replace it*/;
/*More statements you can use (optional). See documentation*/
	getnames=;/*Yes or No*/
	guessingrows=;/*Used to guess the column type and length*/
run;

 

2. If you are looking to export to an html file look at ODS html. ODS HTML Documentation

 

Quick example for a sample SAS table you should have

ods html body="C:\Where\You\Want\The\HTMLFile\Testfile.html"/*<--Change this location*/ style=htmlblue;
proc means data=sashelp.cars;
	var mpg_city;
	class type;
run;
ods html close;

 

View solution in original post

3 REPLIES 3
Panagiotis
SAS Employee

Quick question, your subject says importing/exporting CSV files but your question says exporting HTML. I answered them both, I wasn't sure which you wanted.

 

1. If you want to import/export CSV files the easiest is to proc import and proc export

 

Quick example of proc import

proc import datafile="Location/of/file.csv"
		dbms=csv
		out=SASoutputTableName/*Creates the SAS table from the CSV file*/
		replace /*If out table exists replace it*/;
/*More statements you can use (optional). See documentation*/
	getnames=;/*Yes or No*/
	guessingrows=;/*Used to guess the column type and length*/
run;

 

2. If you are looking to export to an html file look at ODS html. ODS HTML Documentation

 

Quick example for a sample SAS table you should have

ods html body="C:\Where\You\Want\The\HTMLFile\Testfile.html"/*<--Change this location*/ style=htmlblue;
proc means data=sashelp.cars;
	var mpg_city;
	class type;
run;
ods html close;

 

GreggB
Pyrite | Level 9

Thanks. My title must have been an autofill.

Panagiotis
SAS Employee

I forgot to mention, if you want to review proc import and the ODS statement take a look at the free SAS Programming 1 Essentials e-learning course. Proc import is taught in chapter 2 "Accessing Data", and in chapter 6 "Exporting Data" the ODS statement is taught.

 

SAS Programming 1: Essentials - Scroll to where it says Self-Paced e-Learning and it should say free. Click start and review the entire course or the chapters you need!

 

- Peter

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3572 views
  • 2 likes
  • 2 in conversation