BookmarkSubscribeRSS Feed
GuiVtzl
Fluorite | Level 6

Hello everyone,

I have some trouble importing a table that looks that way :

Sans titre.jpg

I need to create a table SAS with data from line 4 AND get variables names on line 3. But I can't make it.

I tried :

proc import out=xll.input

datafile="/data/&input_drf."

dbms=xlsx REPLACE;

SHEET='Clients';

datarow=4;

run;

But it gets me "The SAS SYSTEM" "B" "C" etc as variables. Plus, the ID became of kind "4.3080236E12".

Then I tried to add GETNAMES=YES but it produced the very same result...

Could you please help me ? Thanks a lot

5 REPLIES 5
jakarman
Barite | Level 11

The lay-out look to be a SAS report of a dataset displayed with AMO in Excel.  Why would you try to convert a SAS dataset to a SAS dataset when the viewer/browser is just Excel.
 

---->-- ja karman --<-----
GuiVtzl
Fluorite | Level 6

Good morning Jaap,

in fact the reason is simple : I receive that excel as an input from another department in my company, and I can only receive it that way.

So, I absolutely need to import that excel file in SAS

jakarman
Barite | Level 11

Understandable than that guy of the other department did used the AMO and has all that in a SAS-dataset.
He could have send you the SAS dataset. Now you are busy to recreate that one. In the same company corporate cooperation....

The most easy approach would be try to export the selected area you need as a CSV and use that.  Not that much work and a datastep is coded fast.

The ID field is obviously having numbers but you could need to do that as chars. The numeric precision is not reliable above some 12 digits.
ID is for identification I assume something like custom number. Calculations as mean skewness not likely to be expected.

---->-- ja karman --<-----
GuiVtzl
Fluorite | Level 6


Yes that is incredible..And they do nothing to make the task easier.

Above all, I need to automatize a whole process (beginning with the import of that xlsx).

Well converting it to CSV make it not completely automatized but at least I can run the rest of my program...

I did convert it to CSV but for ID I have the same trouble, it becomes digits with E+12 types.

jakarman
Barite | Level 11

Well you are still using it as number not char and there 13 digits.  reading defining it as char (length eg $16) or using a format with 15 digits would help.
But you are at the end of the numeric precision with numbers, They could go off on the last low values. (sas note 123)

---->-- ja karman --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1107 views
  • 0 likes
  • 2 in conversation