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

I imported an Excel file into my SAS program, but now I am having problems trying to graph the data. This is the code I have so far:

 

/* Generated Code (IMPORT) */
/* Source File: EG01-46IQ.xls */
/* Source Path: /folders/myfolders */
/* Code generated on: 1/31/19, 9:08 PM */

%web_drop_table(WORK.IMPORT);


FILENAME REFFILE '/folders/myfolders/EG01-46IQ.xls';

PROC IMPORT DATAFILE=REFFILE
DBMS=XLS
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;

PROC CONTENTS DATA=WORK.IMPORT; RUN;


%web_open_table(WORK.IMPORT);

data WORK.INPUT;

 

The data is an Excel file of one column of numerical data. I do not know if I am supposed to use the datalines command or how to tell SAS what to do with the imported data. Any advice is much appreciated! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Before attempting to graph make sure that the as generated by the Import step matches your expectations. Proc Import uses a few rows of the data to guess what variable types and lengths the values will be. Because of the unstructured nature of spreadsheet files where a single column of data can have character values, numeric values and dates you may expect one form of data but not get it. Verify that the values you need to be numeric for your process are, that dates or times are SAS values with formats such as Date9,r mmddyy or time and simple $ (character) of best (numeric) as they will not behave as dates when needed.

 

 

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

That code you post (and please avoid coding all in upper case!!) simply imports a spreadsheet into a dataset - a dataset is SAS storage for data.  The contents just prints metadata about the data.  To do a graph you then need to submit further code for how to and what to produce.  If you do not know anything about SAS, then its a good idea to go through the SAS videos:
https://video.sas.com/category/videos/how-to-tutorials

To learn how to use the software, in that you will see how you can manipulate and process data, and produce a variety of outputs.

When you are sufficiently clear on using SAS, then look at this blog, in which you will find code examples of most types of graphs:

http://blogs.sas.com/content/graphicallyspeaking/

ballardw
Super User

Before attempting to graph make sure that the as generated by the Import step matches your expectations. Proc Import uses a few rows of the data to guess what variable types and lengths the values will be. Because of the unstructured nature of spreadsheet files where a single column of data can have character values, numeric values and dates you may expect one form of data but not get it. Verify that the values you need to be numeric for your process are, that dates or times are SAS values with formats such as Date9,r mmddyy or time and simple $ (character) of best (numeric) as they will not behave as dates when needed.

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 821 views
  • 0 likes
  • 3 in conversation