I want to read dbf file in sas.
But , I try the following code which can't run .
My sas edition is SAS/STAT 13.2
proc import out = test
datafile = "mypath\filename.dbf"
dbms=dbf
replace ;
run
it showed "ERROE : DBMS type DBF not valid import"
Therefore , I try another code.
proc dbf
it showed "ERROR : Procedure DBF not found"
Please, check which SAS Interface to PC Files version you using. DBF is available for >=9.3 versions.
If you have version below, try to find solution that fits your SAS version, or provide your version here, so we can help you.
Related
I'm having trouble converting .SSD files to .CSV. I first attempted this with SAS Universal Viewer, but that didn't work. Now I'm using SAS Studio On-Demand for Academics. The data I'm using are from here.
I uploaded two data files (ACCIDENT.SSD and VEHICLE.SSD) from that source to a folder called NASS in SAS Studio and attempted to define that folder as a new library. However, I'm getting hung up on the library creation step.
LIBNAME NASS v6 '/home/u59316558/sasuser.v94/NASS';
PROC EXPORT DATA=NASS.ACCIDENT
OUTFILE="/home/u59316558/sasuser.v94/CARS.csv"
dbms=csv replace;
which returns
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 LIBNAME nass v6 '/home/u59316558/sasuser.v94/NASS';
ERROR: The V6 engine cannot be found.
ERROR: Error in the LIBNAME statement.
70 PROC EXPORT DATA=NASS.ACCIDENT
71 OUTFILE="/home/u59316558/sasuser.v94/CARS.csv"
72 dbms=csv replace;
73
74 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
ERROR: Libref NASS is not assigned.
ERROR: Export unsuccessful. See SAS Log for details.
84
How can I convert these .SSD file to .CSV in SAS Studio or otherwise?
Per the Libname engine documentation, you likely cannot read these in directly, with any current version of SAS. .ssd files are v603 or v604 datasets, and unfortunately x64 64-bit SAS does not have the ability to read these in whatsoever, barring reverse-engineering the file format.
As noted in Tom's comment, your best option is likely a third party such as Stat/Transfer or similar which might allow you to read it in, or failing that finding a 32-bit SAS installation - but that's likely difficult to do at this point.
I am trying to run some R code in SAS but I am getting a weird error: The RLANG system option must be specified in the SAS configuration file or on the SAS invocation command line to enable the
submission of R language statements.
Could I please get some assistance?
PROC IML;
SUBMIT / R;
# Copy-paste the section below into the R command prompt, # but only after editing with the correct path to the input data file.
# Lines that begin with the # character are taken as comment lines by R.
# $PATH in the line below is your specific data file path in full
# $PATH specifies the location of the input data file, assumed to be named mydata.csv
# $PATH file path is constructed with \ in Windows and / in Linux, Mac
# input data file mydata.csv must be in CSV comma separated value format
mydata <- test.csv("$PATHC:\Users\Christos\Desktop\test.xlsx")
# define the logit model
mymodel <- default ~ student + balance + income
# invoke logit regression
mylogit <- glm(formula = mymodel, data = mydata, family = binomial(link="logit"))
# display results of logit regression
summary(mylogit)
ENDSUBMIT;
QUIT;
Thanks in adavanced!
You have to tell SAS before it starts that you want to enable the integration with R. That is what the RLANG option does.
If you attempt to submit R statements on a system that was not
launched with the -RLANG option, you get the following error message:
ERROR: The RLANG system option must be specified in the SAS
configuration file or on the SAS invocation command line to enable the
submission of R language statements.
Some operating systems do not support the RLANG system option. The
RLANG system option is currently supported for the Windows and Linux
operating systems. If you attempt to submit R statements on a host
that does not support the RLANG option, you get the following warning
message:
WARNING: SAS option RLANG is not supported on this host.
If you are launching SAS from the command line just add the -rlang option to your command. Otherwise add to one of the config files that SAS is using. For example on Unix you could add it to the sasv9.cfg file in your home directory. If you are using a workspace server (via SAS/Studio or Enterprise Guide for example) then you probably need to talk to your local SAS installation team to have that option added to the configuration file.
I am using SAS Enterprise guide. SAS EG is running on a UNIX server, and I am using a Windows machine. I want to input files in SAS EG for an analysis using INFILE.
The file EXAMPLE.txt is saved on a windows shared drive, which is connected to a folder on the server running SAS EG. The path of EXAMPLE.TXT on the Windows Shared folder:
I:\projects\RWDS\rwds_1619\SASDATA
I can open EXAMPLE.TXT in SAS EG when I go
open - open data - Example.txt
The content of the file is displayed properly in the SAS Process Flow. The path on files on the server, which I can see on SAS EG, is:
W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT
When I try to input the files in SAS EG using INFILE command, I get this error:
ERROR: Physical file does not exist.
/var/opt/teradata/sas/config/Lev1/SasApp/W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT
I used this code:
DATA MYDATA;
data new;
INFILE 'W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT';
INPUT ID $ 1-3 GP $ 5 AGE 6-9 TIME1 10-14 TIME2 15-19 TIME3 20-24;
PROC MEANS DATA=MYDATA;
RUN;
TITLE;FOOTNOTE
Expected result is to load the file EXAMPLE.TXT into SAS EG
Many thanks for your help!
This confirms you are running SAS on Unix/Linux
ERROR: Physical file does not exist. /var/opt/teradata/sas/config/Lev1/SasApp/W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT
You will need to specify the filename using the server point of view.
/unix-specific-file-path-to/EXAMPLE.TXT
I have PC SAS 64 bit and Office 2013 32 bit installed on my Windows machine. I am trying to use the import wizard and it gives me
ERROR: Failed to connect to server.
Can anyone help me to sort this out?
I have selected Microsoft Excel Workbook on PC Files Server rather than Microsoft Excel Workbook (*.xls *.xlsb...) as "Standard data source".
I've had the same problem when tried to import file that was in use by another user.
Copy the file with different name or location and try to run import again.
Could you check with a sas program and try to change the engine :
Like
/* import */
PROC IMPORT
DATAFILE="c:\test.xlsx"
OUT=WORK.TEST
DBMS=XLSX REPLACE;
RANGE="Sheet1$A1:G";
GETNAMES=YES;
RUN;
Try with DBMS=excelcs or DBMS=XLSX or DBMS=excel,
with the extension from *.xslx to *.xls
and check correct pathname.
The following two exports, will give an error on my machine (in both SAS base and SAS Enterprise Guide):
proc export data= sashelp.shoes
outfile= " D:\SAS\myfile.xlsx"
dbms=xlsx replace;
sheet="Shoes";
run;
proc export data= sashelp.class
outfile= " D:\SAS\myfile.xlsx"
dbms=excelcs replace;
sheet="Class";
run;
as these exports produce the following errors respectively:
ERROR: DBMS type XLSX not valid for export.
ERROR: DBMS type EXCELCS not valid for export.
By browsing the internet I think that the problem is caused by exporting the file from a 64-bit SAS version to a 32-bit Excel version.
I downloaded and installed pcfilesrv__931401__win__en__web__1.zip from the SAS Support website and hoped it would solve the problem, however the errors still occur.
Anybody with another idea?
Specs:
Windows 64-bit Operating System
SAS Enterprice Guide 5.1 (64-bit)
SAS Base 9.3 (64-bit)
Excel 2013 (32-bit)
EDIT:
#Grinvydas Kareiva mentioned in his answer that I needed the "SAS/Access Interface to PC Files". This installation wizard after running setup.exe in the zip file I downloaded from the SAS Support website (see above).
However, when I run proc setinit, it doesn't show up anywhere (changed site number and name manually):
Site name: 'xxxxxxx'.
Site number: xxxxxx.
Expiration: 01SEP2017.
Grace Period: 62 days (ending 02NOV2017).
Warning Period: 31 days (ending 03DEC2017).
System birthday: 01NOV2016.
Operating System: WX64_WKS.
Product expiration dates:
---Base SAS Software 01SEP2017
---SAS/STAT 01SEP2017
---SAS/GRAPH 01SEP2017
---SAS Enterprise Guide 01SEP2017
---SAS Workspace Server for Local Access 01SEP2017
Am I doing something wrong?
Firstly, you need to have licensed "SAS/ACCESS Interface to PC Files".
You can check that in the log after submitting
proc setinit;
run;
One of these should work if you have that interface
dbms=excel or dbms=xlsx
In SAS 9.4 TS1M1 and later, you can use ods excel to export actual xlsx files without the license for ACCESS to PC FILES. In SAS 9.3, this functionality isn't available.
use the below code to export excel or csv file
/*import the .xlsx or csv file */
FILENAME REFFILE '/<path to file>/Statistic_Details.xlsx';
PROC IMPORT DATAFILE=REFFILE
DBMS=XLSX
OUT=libref.Statistic_Details;
GETNAMES=YES;
RUN;
PROC CONTENTS DATA=libref.Statistic_Details; RUN;