excel to SAS

#1
library work 'c:\documents and settings\desktop\s'
data s.sas;
infile 'C:\Documents and Settings\Desktop\sas.prn' firstobs=2;
input subject salary job jobtitle $ yrsatjob gender age manager $;
run;

I cannot get this code to read in an excel sheet into SAS. I am saving it as a space delimited file. Any help? This should be very simple but I am getting output that is only the odd numbered observations and the data is shifted right and rearranged within the ouput file. ANY HELP/SUGGESTIONS?
 

Link

Ninja say what!?!
#2
what extension is the excel file saved as? you're trying to import a "sas.prn" file. What's the prn extension?
 
#4
.prn is space delimited. and as for the libname statement, just disregard that line. Yes mean joe, you are correct. I mistyped work instead of s. That is not the problem though. the .prn is how I learned to read in data from an excel sheet in college. I have multiple examples from college with infile and .prn in them. I'm wondering if it has something to do with me being connected to a secured network at work. Has anyone ever had problems with that?
 
#5
If you have SAS why not just use the import feature in Enterprise Guide. I have never had a problem pulling in an excel document with that. If you don't want to work in EG just save the table you create to a permament library and work from that in "normal" (9.2) SAS.
 
#6
I have actually been talking to our help desk and we have fewer liscenses than people using sas on a secured network so there is trouble with loading features of SAS. Thank you all though.
 

Mean Joe

TS Contributor
#7
One more thing to try -- this is the code that I see in the log file when I use the Import Wizard. Maybe you can run this raw code in place of the Wizard that you need a license for?

Code:
data sas_prn;
	%let _EFIERR_=0; *set the ERROR detection macro variable;
        infile 'C:\Documents and Settings\Desktop\sas.prn' DLM='09'x MISSOVER DSC lrecl=32767;* firstobs=2;
	informat subject salary job jobtitle $25. yrsatjob gender age manager $25.;
	format subject salary job jobtitle $25. yrsatjob gender age manager $25.;
        input subject salary job jobtitle $ yrsatjob gender age manager $; 
	if _ERROR_ then call symputx('_EFIERR_',1); *set ERROR detection macro variable;
run;