sas

SAS connection to Teradata Database using Teradata ODBC

南楼画角 提交于 2019-12-30 11:08:24
问题 I'm trying to connect to Teradata in SAS. I set up an teradata ODBC on the machine. The assumption currently for me is that using ODBC is the only way for me to access the database. And here is the syntax of my connection command: Libname Teradata ODBC dsn = 'dsnname' uid = 'uid' pwd = 'pwd'; results: Error: The ODBC engine cannot be found. Error: Error in the LIBNAME statement. It keeps saying that the ODBC engine cannot be found. I'm really confused now. Is there anything wrong with the

How can we import files from PC directly in SAS University Edition?

本秂侑毒 提交于 2019-12-30 11:08:23
问题 I am using SAS University Edition and i have to import files into SAS software. I have tried using 'infile' and 'proc import' statements but these are not working when accessing the files directly from PC. Is there a way to access the files directly from PC in SAS UE? 回答1: Yes. In the folder where you have SAS University Edition VM located created a folder called myfolders . In the VM create a shared folder to that folder using the VM settingsn th Move the file to that location and use a UNIX

Calculating rolling correlations in SAS

主宰稳场 提交于 2019-12-29 09:31:09
问题 I have a data set here. An excerpt of my data looks like this: (For an enlarged version: http://puu.sh/79NCK.jpg) (Note: there are no missing values in my dataset) I wish to calculate the correlation matrix using a rolling window of 1 year. My period starts from 01 Jan 2008. So for example, the correlation between AUT and BEL on 01 Jan 2008 is calculated using the series of values from 01 Jan 2007 to 01 Jan 2008, and likewise for all other pairs. Similarly the correlation between AUT and BEL

Subsetting a dataset by selecting variables based on keywords in their name in SAS

帅比萌擦擦* 提交于 2019-12-29 08:21:34
问题 I hope someone can help. I have a large dataset imported to SAS with thousands of variables. I want to create a new dataset by extracting variables that have a specific keyword in their name. For example, the following variables are in my dataset: AAYAN_KK_Equity_Ask AAYAN_KK_Equity_Bid AAYAN_KK_Equity_Close AAYAN_KK_Equity_Date AAYAN_KK_Equity_Volume AAYANRE_KK_Equity_Ask AAYANRE_KK_Equity_Bid AAYANRE_KK_Equity_Close AAYANRE_KK_Equity_Date I want to extract variables that end with _Ask and

convert numeric sas date to datetime in Pandas

房东的猫 提交于 2019-12-28 13:56:26
问题 I am using Pandas 0.18 and read_sas to load a sas7bdat dataset. The dates in the Pandas dataframe appear as: Out[56]: 0 19411.0 1 19325.0 2 19325.0 3 19443.0 4 19778.0 Name: sas_date, dtype: float64 pd.to_datetime does not recognize this format. What should I do parse the date correctly? Thanks! 回答1: According to this link, [A] SAS date value is a value that represents the number of days between January 1, 1960, and a specified date Therefore, if we convert the numbers to Pandas Timedeltas

Fill the blank values of a variable with the previous non blank value SAS 9.3

给你一囗甜甜゛ 提交于 2019-12-28 12:44:30
问题 I'm using a dataset which is something like : +----------+--------+-------+ | Variable | Level | Value | +----------+--------+-------+ | sexe | men | 10 | | | female | 20 | | age | 0-20 | 5 | | | 20-40 | 5 | | | 40-60 | 10 | | | >60 | 10 | +----------+--------+-------+ And I would like to fulfill the "blank" cells using the previous non-blank cell to obtain something like this. +----------+--------+-------+ | Variable | Level | Value | +----------+--------+-------+ | sexe | men | 10 | | sexe

Fill the blank values of a variable with the previous non blank value SAS 9.3

前提是你 提交于 2019-12-28 12:44:10
问题 I'm using a dataset which is something like : +----------+--------+-------+ | Variable | Level | Value | +----------+--------+-------+ | sexe | men | 10 | | | female | 20 | | age | 0-20 | 5 | | | 20-40 | 5 | | | 40-60 | 10 | | | >60 | 10 | +----------+--------+-------+ And I would like to fulfill the "blank" cells using the previous non-blank cell to obtain something like this. +----------+--------+-------+ | Variable | Level | Value | +----------+--------+-------+ | sexe | men | 10 | | sexe

ODBC Password Security in SAS

一曲冷凌霜 提交于 2019-12-28 06:58:54
问题 We want to remove hardcoded passwords from ODBC connection strings in our SAS code, and also prevent any of the passwords from appearing in the SAS log files. There seems to be plenty of whitepapers discussing how to go about this but I either find problems with them, or can't get them working. Prompting the user each time for the PW is not a viable alternative. Also, storing the password in a macro variable is an acceptable approach, as long as you have a way to suppress it from printing to

SAS list and store all tables name under specify library to a table

不羁岁月 提交于 2019-12-26 12:31:45
问题 Under library "testing", i have 5 datasets. How can i list all tables names? proc datasets lib = work; quit; run; While i would like to have further usage of the information. like the tables name. Thanks 回答1: Use the SQL dictionary.tables view... proc sql ; create table mytables as select * from dictionary.tables where libname = 'WORK' order by memname ; quit ; 回答2: Proc sql; select * from sashelp.vmember where libname = "TESTING" ; quit; Make sure to put the library name in upper case. 回答3:

pick observation or row having longer name in sas

懵懂的女人 提交于 2019-12-25 19:39:50
问题 i have dataset a like this id name age sex 1 Murray, W 23 M 2 Bonaventure, T 24 F 3 Eberhardt, S 56 M 4 LaMance, K 78 M 5 Underwood, K 23 F we have to create dataset b from dataset a id name age sex 2 Bonaventure, T 24 F we have to select data having longer name in all name variable so we have to select the observation having longer name so dataset b contain only one data. 回答1: You need to find first the maximun length across all records and then compare it against each indiviual record's