I have little to no experience in SAS. But what I would like to do is read in 2 excel spreadsheets into 2 separate temporary datasets.
The files names are C:\signature_recruit.xls and C:\acceptance_recruit.xls.
How do I accomplish this?
For simplicity, you will want your excel files to look like a SAS data set. That means that you should only have rows and columns of data. If desired, the first row can be the names of the columns(variables).
Now you can either write proc import code yourself to read the excel file, or you can use the Import wizard to click through the process. This has a helpful feature in that after you click though dialog, you can have it save a program that contains the proc import code that the wizard generated to read the excel file. You can then save and reuse this code if needed.
To start the import wizard, go to File->Import Data. The default option is to import an Excel file. Browse to the spreadsheet and answer the questions. Repeat for both spreadsheets.
With luck, this should be all you need to do to get the file into SAS. Here is a link to some more info and examples.
An alternative to cmjohns PROC IMPORT approach above is to use DDE. It's an older technology and is more difficult to use but it does provide greater flexibility for complex scenarios.
Plenty has been written on doing this. For example:
http://www.lexjansen.com/wuss/2010/DataPresentation/3015_4_DPR-Smith.pdf
Cheers
Rob
Related
In Visio I am creating an Org Chart, using the 'Import Organization Data', and using 'Information that's already stored in a file or database'. When I select my xlsx file, it pulls in all of the data. However, what if I wanted to only create an org chart out of a subset of the data? Currently I'm applying a filter to the data in Excel, copying the result to a new Excel file, and using that new file to import into Visio. A slightly less bad version of this would be if I could at least copy the filtered data into a different sheet in the same file, but the Visio Import doesn't even seem to let me select which sheet to use. This is very annoying - is there a better way?
Though I could never get Visio to ask me which table/sheet I wanted to use within a single file, I found what I consider an acceptable workaround using inspiration from #y4cine's suggestion.
I created separate "slice" xlsx files, where in each of those I used a Power Query against the data in the main xlsx file. Then I can point Visio to one of those slice files and it will happily make an org chart with the slice of data I was interested in.
A bit clunky, but it sure beats repeated copy/pasting :)
I have a lot of CSV files which I created by gathering data from a website. The CSV files all have the same type of format as they are just different sets of data with the same headers. For example:
School,Carleton University
School Facts,
SchoolName,Carleton University
Location,"Ottawa, ON"
SchoolType,University
Language,English
Student Count,"24,554 Students"
Student Type,Full-time Undergraduate
Would be a standard CSV I have where other CSVs would just contain a different entry for things like SchoolName, Location etc.
What I wanted to do was open one of these files and then format it a certain way (ie. highlight certain things like SchoolName row, or things like School Facts to make the document easier to see). I was wondering if its possible I can do it for one and the just import other CSV's and they would automatically be the same way? If it is how do I do it or is there another way I can go about handling the data from the CSV to make it presentable?
Thank you, not sure if I am asking this right as I am new to excel and using CSV's in general.
Open your csv, record a new macro in a personal workbook, format your csv, stop recording.
Make sure to select the whole column when you format so if your next csv has more line, the format will still work. Save your macro, and you should be able to run it everytime you open a new file.
You could import it into a tab and have another tab that maps to all the fields in the tab you import to, and make the 2nd tab formatted however you like.
Also check out conditional formatting for things like highlighting things that meet certain criteria.
I am looking to merge about 15 different excel files to create one dataset. I know the variables in the coding are the same in each file. The problem is that the start rows for all of the data is inconsistent for each xls. Is there a way to use proc import and identify specific rows to import for each file?
Thanks!
Assuming you are using DBMS=EXCEL, you have the RANGE option available to you:
proc import file="myfile.xlsx" out=mydataset dbms=excel replace;
range="'Sheet1$A1:Z1000'";
run;
Obviously change Sheet1, A1, and Z1000 to match what you need.
This manual page contains further information on other DBMS options, including for DBMS=XLS.
We need to upload a small amount of additional records to a table from an Excel sheet. Is there a way to use the Access Import function to add the additional data to the table (truncate it). The table was created by uploading the same Excel sheet. But now, when records are added, we need to add them to the table. The tables are linked to SQL but I do not want to use an SSIS because there are only a few records and there must be a way to use Access functions. Suggestions please.
It may be easiest to link the excel sheet and run an append query to add data from Excel to existing table. Once linked, this can be done in the query design window.
You did not specify versions of Excel or Access.
I did this with a test 2003 Excel sheet with cells containing 1000+ characters. An import in Access 2003 detects the data type as a memo field, which is correct, when there are that many characters, so it should work for you. It may be your Excel data has other ingredients causing an import issue. How is the excel data derived?
Have you tried importing to Access? It should work fine. If your ultimate target is another database why use Access as an intermediary?
I agree a linked table seems like a really simple method to update a table if you are using Access, but that is your choice.
I want to import data from Excel into corresponding tables based on different column data's on based on ID's like customer data on based on CustomerID present in Customer table.
Means we have to extract data from the table and Excel source on basis of ID's.
Could you please help me out on this?
Use the SQL Server Data Import Wizard - see an article on it here.
(source: databasedesign-resource.com)
This wizard allows you to define your Excel file to import, it allows you to define the target where to put the data, it allows you to define mappings between columns in Excel and columns in your SQL table, and much more.
Update: based on your comment to the other answer, if you need to import the Excel sheet and match it up to some pre-existing lookup data, then you should definitely look at the SQL Server Integration Services (SSIS) which are there exactly for this kind of import/lookup scenario.
Your question's gamma is a bit all over the place so not entirely sure what you are asking about but here goes.
You can save you excel spreadsheet as a CSV file and then import that into your database. There a number of tutorials on this if you search google. Try searching "import CSV into database".