DATA Step, Macro, Functions and more

importing data when variable has different data types in excel sheets?

Reply
Occasional Contributor
Posts: 13

importing data when variable has different data types in excel sheets?

 I need to extract this data from excel file. the thing is, in the below variables the date variable consists of both numeric and charater data type. while iam reading into sas ,i am getting only few records.  i should get all records into sas data set.

 

could you please help me ?

the below attchement consists of sample of my data.

 

thanks in advance

DateparticularschequeNO/OrderNo
23/06/06received234554
11/8/2006received798242
12/8/2006received985795
20/08/06received298489
26/08/06received988323
28/08/06received248927
31/08/06received598332
5/9/2006received284729
3/9/2006received287492
15/9/2006received279872
1/9/2006received258202
2/9/2006received928590
1/11/2006received209842
5/12/2006received595972
5/12/2006received902892
20/12/06received298297
   

 

SAS Super FREQ
Posts: 8,868

Re: importing data when variable has different data types in excel sheets?

Posted in reply to praveenkotte
Hi:
What code have you tried? Easiest way would be to fix the format of the column in Excel to be a type of date and then if the only character value is the column header, PROC IMPORT or the LIBNAME engine should be able to read the date value correctly.

cynthia
Occasional Contributor
Posts: 13

Re: importing data when variable has different data types in excel sheets?

Posted in reply to Cynthia_sas

i've tried these two codes. but instead of using libname statement, i should pull out the data using proc import or else proc sql.

proc sql;
connect to excel(path="C:\Users\siddiq\Desktop\Book1.xls");
create table tab as
select * from connection to excel
(
select * from [sheet1$]
);
disconnect from excel;
quit;

 

 

 

proc import datafile="C:\Users\siddiq\Desktop\book1.xls"
out=dd
dbms=excel
replace;
run;

Valued Guide
Posts: 505

Re: importing data when variable has different data types in excel sheets?

Posted in reply to praveenkotte

OT Because I present a SAS, WPS and R Solution

If interested see 

https://listserv.uga.edu/cgi-bin/wa?A2=SAS-L;47be38ca.1607c

 

 

Ask a Question
Discussion stats
  • 3 replies
  • 274 views
  • 0 likes
  • 3 in conversation