Good morning all,
while importing excel there is a problem.
if the excel data contains some data and some title statement.
I know how to import it into sas, But is there any possible chance to import title also while importing.
the data is like this
ABC company ltd
Employee details on 11/03/2015
under the data is as follows in cell
DATE EMP_ID ENAME SALARY
so these kind of data how we import it into sas.
Through proc print it is possible. But through data step is there any possible to import with title also.
Thanks in advance.
You could try to store the "title" in an additional column, and write a data step so that it detects the title(s) line(s) and assigns these values to retained variables. Every record in the SAS dataset will then also hold the title(s) data.
Or you could preserve the title(s) in macro variables and then use these to set a label for the whole dataset.
proc import will not be able to handle this, as it already needs a database-like table structure in the input data.
Hi,
I think we covered this in your other question. Excel is a free-for-all bearing no resemblance to any other method of working. You need to have the concept of "data" ie tabular, fixed structure dataitems, and presentation - layouts, titles, footnotes etc. separate. How you go about doing this can be a matter of taste. You could for instance write a VBA macro which pulls all titles out, saves them to their own CSV for importing, then pulls the data out and saves that to a CSV. You could also go directly into the XLSX file (if thats what it is) and pull certain elements out. A third option would be to use a libname statement to Excel and pull out certain elements from that: http://www2.sas.com/proceedings/sugi31/024-31.pdf
So to finish, your problem is Excel. Fix that, there are a multitude of data transfer formats around - CSV, XML, Json, Delimited, DB etc. use one of those and your life will be far easier.
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.
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.