SAS Nested Likelihood Ratio Test for a Logistic Model

Using SAS Studio (online, student version)... Need to do a "nested likelihood ratio test" for a logistic regression. Entirety of instructions are: "Perform a nested likelihood ratio test comparing your full model (all predictors included)to a reduced model of interest." The two models I have are: Proc Logistic Data=Project_C; Model Dem (event='1') = VEP TIF Income NonCit Unemployed Swing; Run; and Proc Logistic Data=Project_C; Model Dem (Event='1') = VEP TIF Income / clodds=Wald clparm=Wald expb rsquare; Run; I honestly have …
Category: Data Science

Calling the column values when column names are date macro variables

In SAS, I have a dataset which has 5 columns and 4 rows. The column names are date macro variables. I want to subtract the values in one column from another. (Date of column 4- date of column 3) doesn't work. This subtracts the date itself and not the values in those columns. How do I call the values of the columns. Please help.
Topic: sas
Category: Data Science

What pandas function is most similar to the transpose procedure in SAS?

I am trying to transpose Amt by Txn_ID across Item_Desc in Python using pandas. Which pandas function(s) is/are most similar to the transpose procedure in SAS? Below is an example of the input dataframe and the desired output dataframe. Input DataFrame: | Txn_ID | Item_Desc | Amt | |--------|-----------|------| | 1 | Apples | 0.96 | | 1 | Milk | 2.10 | | 2 | Eggs | 7.00 | | 2 | Flour | 2.20 | | 2 | …
Category: Data Science

How to import SAS model ZIP file into python?

Is there a way to load a trained SAS model exported from Viya in ZIP file format into Python? I mean, kinda like loading a trained model from a pickle file. If it helps, here's the content of the ZIP file exported from SAS: ├── ModelProperties.json ├── ScoreCode2043634672.sas ├── dmcas_fitstat.json ├── dmcas_lift.json ├── dmcas_packagemetadata.json ├── dmcas_packagescorecode.sas ├── dmcas_properties.json ├── dmcas_relativeimportance.json ├── dmcas_scorecode.sas ├── dmcas_scoreinputs.json ├── dmcas_scoreoutputs.json ├── dmcas_targetInfo.json ├── ds2_pkg_score.sas ├── ds2_score.sas ├── fileMetadata.json ├── inputVar.json ├── master.json ├── outputVar.json …
Category: Data Science

SAS Studio seems to imply that apparently non-normal data is normal

I have some data I'm trying to analyze in SAS Studio (university edition). I am using the Distribution Analysis feature to try to test some data for normality. It gives me the following histogram: Skewness is approximately 2.934 and Kurtosis is approximately 9.013. I would have assumed based on that (and the fact that the shape of the histogram looks so different than the normal curve) that this is not normally distributed. However, my goodness-of-fit tests are: The Kolmogorov-Smirnov D …
Category: Data Science

Displaying date in SAS

I am trying to display a date in my result after running the below program in SAS. It runs properly but in the sas data table under DOB column I don't get anything except a period . Below is my code what am I doing wrong? data sample; Input ID name $ Dob; Format DOB mmddyy10. ; datalines; 1 abc 22jan1996 2 xyz 25aug1996 ; run; Proc print data = sample; run; Also I would like to know what does …
Topic: sas
Category: Data Science

scaling credit risk scorecard

I need to build a credit risk scorecard using logistic and linear regression. The variables using to predict are all dummies, where each dummy is a bin of some variable. Let's say the variable age, I have 4 dummy bins for "age": age_20 (1 when client has less than 20), age_2030 (1 when client betwen 20 to 30), age_3040 (same for 30 to 40), age_4050 (same for 40 to 50). I have more variables like this. To run the linear …
Category: Data Science

How to create a SAS Library Folder

I am trying to create a folder to use in the SAS library. I have tried to do this many different ways. Every time I run the code it always says that the path does not exist. Below is my error messages from my last attempt: 72 73 libname "D:\Users\clkehl01\Documents\myprj1\"; ERROR: "D:\Users\clkehl01\Documents\myprj1\" is not a valid SAS name. ERROR: Error in the LIBNAME statement. 74 75 data myprj1.autos; 76 set sashelp.cars; 77 run; ERROR: Library MYPRJ1 does not exist. NOTE: …
Category: Data Science

Making Prediction on logistic regression using SAS

proc logistic data= train descending; class Emp_status Gender Marital_status; model Default = Checking_amount Term Credit_score Gender Marital_status Car_loan Personal_loan Home_loan Education_loan Emp_status Amount Saving_amount Emp_duration Age No_of_credit_acc; run; As you can see, I already made a logistic regression on train dataset. However, how can I make the prediction on the test dataset? I checked online, but there are not many sources to implement this.
Category: Data Science

How can I use a class variable with many possible values in logistic regression?

I am attempting to build a logistic regression model that determines the probability of an outcome based on a set of independent variables. For context, the data is based on a project in which sales representatives and branch managers for a builders merchant were given price recommendations for their customers' deals, and were given the option of saying 'Yes' or 'No' to these price recommendations. The Yes or No answer is my dependent variable; I need to determine which variables …
Category: Data Science

Using by statement in proc esm

I was using proc een in SAS, for time series forecasting. I want to include two variables in by statement. My data contains four columns: Shop_id Item_id Item_price Date The item_price column is the one which should be forecasted. The date is in months. I want to include both shop_id and item_id in the by statement Is it possible ?
Category: Data Science

How to make R or Python as fast as SAS for ODBC Oracle queries?

I want to use R or Python to query big structured SQL-type data, but they are very slow compared to SAS. I tried using R and Python to return a 1.3 million record Oracle ODBC passthrough query. The query took 8-15 seconds in SAS, 20-30 seconds in Python, and 50-70 seconds in R. Does anyone know why? R Packages Used: First I used the RODBC package in R to query to the Oracle database. Then I tried the ROracle package, …
Category: Data Science

SAS procedure IF THEN ELSE loop did not recognize the Roman letters or numbers as value

I have written the following SAS procedure to display Grades based on the salary: Not Working: This displays only 'I' for all observations irrespective of the else condition that says any salary less than 35000 should have a Grade as 'II' DATA Test (Keep = FirstName LastName Salary Grade); set orion.sales; if salary < 35000 then grade = 'I'; /* Did not interpret 'I' */ else grade = 'II'; /* Did not interpret 'II' */ run; proc print data = …
Topic: sas dataset
Category: Data Science

Are SAS Data Storage Options designed for Big Data?

I understand that SAS has some data storage options in the form of Default Storage tables or SAS datasets - in the SAS library. Multi-dimensional Storage cubes - in the OLAP Server. Third Party Storage - into external databases like SQL Server ,Oracle, DB2, Teradata etc. Parallel Storage - ? My Questions are: Are any of these data storage options designed for moderately big data i.e. data over a million observations? Is this quantification at all affected by the machine …
Topic: sas dataset
Category: Data Science

Logistic Regression in R models for 1 or 0?

According to this link, it says SAS models for 0, To model 1s rather than 0s, we use the descending option. We do this because by default, proc logistic models 0s rather than 1s What happens in case of R's glm function? Does it model for 1 or 0? Is there a way to change it? Does it matter?
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.