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 (January 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 3 Jan 2007 23:28:23 +0100
Reply-To:     LouisBB <nospam@HCCNET.NL>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         LouisBB <nospam@HCCNET.NL>
Subject:      Re: Help
Comments: To: sas-l@uga.edu

Dear Sibusiso Moyo,

The infile/input combination is used to read text files. You are using it on an excel spreadsheet. For this other methoods are available, like the excel libname engine.

This sample of (untested) code could do the trick for you.

Options validvarname=any; libname artxls excel ''C:\myrawdata\artists.xls'; data artists; set artxls.'sheet1$'n; run; libname artxls clear;

Background info is in the documentation at: http://support.sas.com/onlinedoc/913/docMainpage.jsp or: http://support.sas.com/onlinedoc/913/getDoc/en/acpcref.hlp/a002107496.htm or: http://support.sas.com/onlinedoc/913/getDoc/en/acpcref.hlp/a002644677.htm

Kind regards,

LouisBB.

"Sibusiso Moyo" <smoyo@VT.EDU> wrote in message news:000001c72f5b$fcfe4480$0a00a8c0@sibusisoonline... >I am trying to enter a simple data set into SAS. It works fine if I take >the > excel file and use Stat/Transfer and convert the file into a SAS file. I > encounter a problem though if I try and pull the file directly from Excel. > Can anyone identify where the problem could be? > > > > The data set: > > > Name > > Genre > > Origin > > > Mary Cassatt > > Impressionism > > U > > > Paul Cezanne > > Post-Impressionism > > F > > > Edgar Degas > > Impressionism > > F > > > Paul Gauguin > > Post-Impressionism > > F > > > Claude Monet > > Impressionism > > F > > > Pierre Augaste Renoir > > Impressionism > > F > > > Vincent van Gogh > > Post-Impressionism > > N > > > > My code: > > Data artists; > > infile 'C:\myrawdata\artists.xls'; > > input name $ 1-21 Genre $ 23-40 Origin $ 42; > > proc print data = artists; > > where Genre = 'Impressionism'; > > Title 'Major Impressionist Painters'; > > FOOTNOTE 'F = France N = Netherlands U = US'; > > run; > > > > and the SAS log with issues: > > > > 21 Data artists; > > 22 infile 'C:\myrawdata\artists.xls'; > > 23 input name $ 1-21 Genre $ 23-40 Origin $ 42; > > > > NOTE: The infile 'C:\myrawdata\artists.xls' is: > > File Name=C:\myrawdata\artists.xls, > > RECFM=V,LRECL=256 > > > > NOTE: 1 record was read from the infile 'C:\myrawdata\artists.xls'. > > The minimum record length was 6. > > The maximum record length was 6. > > NOTE: SAS went to a new line when INPUT statement reached past the end of > a > line. > > NOTE: The data set WORK.ARTISTS has 0 observations and 3 variables. > > NOTE: DATA statement used (Total process time): > > real time 0.01 seconds > > cpu time 0.01 seconds > > > > > > 24 proc print data = artists; run; > > > > NOTE: No observations in data set WORK.ARTISTS. > > NOTE: PROCEDURE PRINT used (Total process time): > > real time 0.00 seconds > > cpu time 0.00 seconds > > > > Thanks, > > > > Sibusiso.


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