Hi all,
I am trying to import XLSX file in sas, But i have a FIle with attribute CISNO with values ~4.0161128E12(4016112842745) which i have to convert into z15. format while imorting it
it is possible?
if it is can anyone tell me the code.
It will be very helpful Thanks
can you please tell me the example code if possible
The only way to import .xlsx file into SAS is either using the import procedure, or if you have SAS Access you can use a libname statement. You may be able to modify the format using a libname import, but you would have to look into that. Here's a good paper on that technique:
http://www.lexjansen.com/pharmasug-cn/2014/PT/PharmaSUG-China-2014-PT09.pdf
Do you have or have you installed SAS PC Files Server? That's what I would first go and check. If you haven't installed it, I would go here to figure out what you need and have to do:
http://support.sas.com/kb/52/649.html
You will need to use the pcfiles destination instead though.
It is giving the above out put
so i think i have SAS/ACCESS Interface to PC Files
Then it depends where the xlsx file is located at. If it's on Linux or UNIX, then you shouldn't need to use the PCFILES libname engine. If it's stored on Windows, then you will need to use it.
Also, I see you have the SAS/ACCESS with ODBC. In that case, you can also create an ODBC connection to the excel file and import it that way.
Did you read the link I provided? You need to use the PCFILES engine in the libname statement if it's on Windows.
LIBNAME myxlsx PCFILES SERVER=D2323 PATH='c:\demo.xlsx';
DATA a;
SET myxlsx.'sheet1$'n;
RUN;
You cannot use INFILE with an XLSX file. Well you could, but since it is a ZIP compressed archive of a series of XML documents it will be very hard to read with a data step.
You can use a LIBNAME with the XLSX engine to point to the file.
libname mylib XLSX 'DDA_exclusion.xlsx' ;
proc copy inlib=mylib outlib=work; run;
But there is no way to tell SAS how to interpret the XLSX file columns.
If the values come across as numbers then you should be able to attach the Z15. format to the variable as that the values are displayed with leading zeros.
These the above error i am getting when i use it @Tom
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.