Hi I have a problem like below when I imported the data . Can anyone tell me what is wrong?
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 OPTIONS LINESIZE=70 PAGESIZE=80; 74 PROC IMPORT OUT= WORK.PMSINCE1975 75 DATAFILE="/foldders/myfolders/Lecture_ 75 ! Resources/Chapter3"; ERROR: Unable to determine datasource type. Please use the DBMS= option. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE IMPORT used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 76 DBMS=DLM REPLACE; 77 DELIMITER='20'x; 78 GETNAMES=NO; 79 DATAROW=1; 80 RUN; 81 82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 94
Note that you cannot import a directory, you have to import an individual file. Do not include a slash at the end of the filename if it is not a directory.
Is your file really named Chapter3 with no extension? If so then try just removing the trailing slash.
It is possible in Windows Explorer to set the options so that it does not display the extension when it shows the filenames. Personally I disable that option so that I always see on the screen the real names of the files and not abbreviated ones that are missing the extension.
Could you give me an example please Tom?
Given your other question, Chapter3 is a directory, not a file. DATAFILE needs to be file, not a directory.
"foldders" should be "folders".
And proc import needs to have the dbms= option, according to the type of the file.
Hi,
I successfully imported dataset into SAS. I am trying to rename the variables. However, the warning shows up like the table Work.PMSINCE1975 can't be opened as it does not contain any column. Could anyone give me the solution to fix this issue please?
FILENAME pms "/folders/myfolders/Lecture_ Resources/Chapter3/pm.xlsx"; PROC IMPORT FILE=pms OUT= WORK.MyPMSINCE1975 DBMS=XLSX REPLACE; GETNAMES=YES; RUN; proc datasets; delete mypmsince1975; run; * renaming these variables Page 17; DATA pmsince1975; SET pmsince1975; RENAME var1=year var2=party var3=surname; RUN;
Your program has three steps. Tell us what they are and what each step is doing. The answer to your problem will be obvious once you have done that.
it includes 3 steps : import xlsx file into SAS : creating the file named pms
importing the file to output data WORK.MYPMSINCE1975
DBMS: indicating the type of file that is going to be imported.
deleting the Output data
last is rename the variables.
DATA pmsince1975 * Create the new temporary dataset
SET an existing dataset
Rename each variable
RUN;
I know the problem comes from existing dataset because pmsince1975 does not contain any columns however I still not figure out whythis file does not contain any columns. Could you tell me please?
Here are your steps.
1) Create dataset (proc import)
2) Delete dataset (proc delete)
3) try to read dataset (data step)
Why did you create the dataset at all if you were just going to immediately delete it?
Thanks I got it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.