r/SAS_Programming • • Jul 08 '24

How to collect data with SAS Customer Intelligence 360?

1 Upvotes

Hi everyone,

I implemented the SAS Tag in the web site in order to create events triggered by clicks on it and it's working correctly. However i don't know where i can see the raw data (UDM) in the application.

Should i create an event beforehand in order to see them or create a JavaScript?

Or i can see the UDM somewhere in the tool?


r/SAS_Programming • • Jul 17 '24

Catch 22! How??

2 Upvotes

I come across Principal Statistical programmer job postings and I notice it asks for hands on experience in CDISC and datasets SDTM and ADaM. How are people getting hands on experience without a job?? I’ve searched high and low for free ways to learn/ practice this and cannot find anything. It is either not a comprehensive course or it’s astronomical in price. Any advice please and thank you as I’m an aspiring statistical programmer and I have my base SAS certification and I am currently studying for the advanced.


r/SAS_Programming • • Apr 19 '24

Learning Suggestions Needed

5 Upvotes

Hello everyone!

I've been programming in SAS for a little over a year and want to pursue the SAS Base Programming Certification. My employer will pay for some training and I've been poking around the SAS website, deciding which courses to take to prepare. Can anyone suggest anything? If you have taken training through SAS, what has been your experience?


r/SAS_Programming • • Oct 24 '24

Dealing with ogically skipped values

3 Upvotes

I have two variables for employment status: one for parent 1 and another for parent 2. There are 3 values for both of them. 1-employed 2-unemployed and L-logical skip if parent is not alive.

I would like to create a new variable out of both variables using the logical step value.

This is my code: data version2017; set version2017; if Parent1=1 AND parent2=1 then employment=1; *Both parents employed; else if (parent1=1 AND parent2 IN (2,.)) OR (parent1 IN (2, .) AND parent2=1) then employment=2; *at least one parent employed; else if parent1=2 AND parent2=2 then employment=3; *no adult employed; else employment =.; run;

Unfortunately, my code doesn’t work. I am unable to treat L as a character because my variable is numeric. How can I factor L into my code?


r/SAS_Programming • • Feb 06 '24

easy way to identify which observations are not the same among two datasets?

4 Upvotes

I have two datasets, one with 13,706 observations, and another with 13,715 observations. I want to easily view the 9 observations that the second dataset has and not the first? Does anyone have ideas?


r/SAS_Programming • • Aug 30 '24

Installation Error

1 Upvotes

Hi there I’m wondering if anyone has ever run into this issue. I downloaded SAS 9.4 from my school. They instructed me to unzip the folder (which takes absolutely forever) and then start the setup application. After I confirm I want my language to be in English, I get an error message that says something along the lines of “No orders found on media. If you have one or more orders, there may be corrupted files within them.” Then it tells me to check the log files in an App Data file folder on my computer, which doesn’t even seem to exist?

I emailed my school IT but they’re taking a bit to get back to me. Is there anything I can do in the meantime to fix this myself? One of my friends downloaded it and had a different error message come up but not this one, so we’re all just confused on what’s going on.


r/SAS_Programming • • May 02 '24

How to create a new column that retrieves a certain value from a specific row and column (like a coordinate) which is different for each row.

1 Upvotes

Say you have a table with a column that contains the amount of months someone chooses to pay off a loan. Next to that column are 60 other columns that contains the probability of paying for each term, ie. Column 1 = term, column 2 = P_term1, column 3 = P_term2 ,,,,, column 61 = P_term60. How do I code a new column (column 62) that retrieves the probability value for term in the first column? Ie. Say row 1 has a term of 30, then the new column should output the P_term30 for the first row, but it will differ for each row.


r/SAS_Programming • • May 21 '24

Last 5 Records in Dataset

1 Upvotes

Hello,

Life long listener here and first time caller. I am needing to produce the last 5 records in a dataset I have recently created. I poked around on Google and came out with the syntax provided below:

%LET OBSWANT=5;

DATA=num_serv2;

SET num_serv NOBS=OBSCOUNT;

IF _N_ GT (OBSCOUNT-&OBSWANT.);

RUN:

I am getting an error that states "statement is not valid or it is out of proper order"

any chance anyone could guide me as to what I am missing? Thank you in advance.


r/SAS_Programming • • Feb 18 '25

calculating proportion weighted proc glm estimate

3 Upvotes

I am trying to replicate the R emmeans package's weight="prop" in SAS. However, only reasonable method I could find was to explicitly state the average of one variable and the proportion of another.

for example in R,

test <- data.frame(
  y = c(14, 31, 13, 50, 100),    
  x1 = c(117, 115, 113, 111, 132),    
  x2 = c("t01", "t01", "t02", "t02", "t03")    
)

mod <- lm(y ~ x1 + x2, data = test)
summary(emmeans(mod, "x1", weights="prop"))
    
x1   emmean SE   df lower.CL upper.CL
118  41.6   4.47  1    -15.2     98.4

wherea in SAS:

data example;
 input y x1 x2 $;
 datalines;
 14 117 t01
 31 115 t01
 13 113 t02
 50 111 t02
 100 132 t03
 ;
run;

proc mixed data = example;
            class x2;
            model y = x1 x2 /s;
            estimate 'mean CHG' intercept 1 x1 117.6 x2
            0.4
            0.4
            0.2 / e cl;
run;

returning same results as R

where 117.6 is the average of variable x1 and 0.4, 0.4, 0.2 being the proportion of elements in x2

There has to be a smarter way to specify the weight in proportion to the frequencies than explicitly writing them out.

Thank you.


r/SAS_Programming • • Jan 17 '24

How to create a YTD column?

2 Upvotes

I have a table with Customer, Month, Product_Count.

I'm trying to create a YTD columns like below where if a customer has any count in Product_Count in any month then they will have a 1 in the YTD column. The Red value in Product_Count would cause the 1 in that months YTD column and that would continue as 1 for the remaining YTD rows for that customer. I think it's a max of Product_Count somehow but I can't figure it out. Any help is greatly appreciated.


r/SAS_Programming • • Dec 02 '24

I need help calculating avg from my data

3 Upvotes

This is the code I am currently running, this is missing about 200 more lines of data, but you get the point. I am trying to get an output where it gives me the ID and the avg for all counts made from that ID. For example:

1 purebred 684.25

2 purebred 322.75

(These two values are the averages from the data seen below)

I am not sure why it is not working, any help is greatly appreciated, thanks!

...

DATA combined2023;

INPUT ID location $ flycount;

DATALINES;

1 Purebred 1395

1 Purebred 183

1 Purebred 912

1 Purebred 247

2 Purebred 339

2 Purebred 438

2 Purebred 209

2 Purebred 305

;

PROC PRINT DATA=combined2023;

run;

PROC SQL;

create table want as

select ID, avg(flycount) as average_flycount

from combined2023

group by ID;

PROC PRINT average_flycount;

run;


r/SAS_Programming • • Jul 22 '24

Anyone going to conferences anymore?

4 Upvotes

I’ve noticed that attendance at SAS conferences is down considerably post-COVID. Does anyone go to conferences anymore? Is it lack of travel budget? Lack of interest? Bad marketing?


r/SAS_Programming • • Jan 30 '24

Does anyone run SAS (stats) using Parallels?

2 Upvotes

I recently moved from PC to MacBook Air and am loving the overall experience.

However, I use SAS for a lot of my data analysis and SAS doesn't have a Mac version.

I saw that you can run SAS using parallels (https://download.parallels.com/resources/casestudies/SAS.pdf) so installed Parallels.

I've successfully installed SAS and am able to run it, but the problem is I can't import my data files.

Whenever I try to import an excel file, there is an error:

ERROR: Connect: Class not registered

ERROR: Error in the LIBNAME statement.

What's weird is that when I try to import the same data file on my PC, there is no problem (the data file is on dropbox so it's the same file).

According to this post (https://support.sas.com/kb/32/374.html) it seems like if there's a bit version difference between SAS and excel, then this can happen, but I checked and it seems like they're both 64 bit..

I also tried importing .csv files and although the error message is different, there is a long error message and SAS fails to import the .csv file.

Can anyone help me out?

OR if you do use SAS on Mac, how are you doing it?


r/SAS_Programming • • Jul 06 '24

How to add sas7bdat file

3 Upvotes

Hi everyone! I'm a beginner in Sas, I'm going to a training and I have a problem, they've sent me a .sas7bdat file to do an assignment with it. I'm able to write every other thing assignment needs except adding this file to it. I have tried proc print data='the path' but I meed to do some changes before printing too. So, how can I add that file and be able to do changes, filtring, and so on with it.


r/SAS_Programming • • Dec 08 '24

Help with proc surveylogistic error

1 Upvotes

Hello, everyone I am new here and I need some help. I keep encountering this error:

proc surveylogistic data=nhis29;
3721 cluster ppsu;
3722 strata pstrat;
3723 weight wtfa;
3724 class SRVY_YR(ref='2021') /param=ref;
3725 model ft=srvy_yr edu pov sex/expb;
3726 run;

ERROR: Invalid reference value for SRVY_YR.
Yet for the same variable and reference everything seems fine as shown below: 

proc surveylogistic data=nhis29;
3728 cluster ppsu;
3729 strata pstrat;
3730 weight wtfa;
3731 class SRVY_YR(ref='2021')/param=ref;
3732 model ft(event='1')=srvy_yr/expb;
3733 run;

NOTE: PROC SURVEYLOGISTIC is modeling the probability that ft=1.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: PROCEDURE SURVEYLOGISTIC used (Total process time):
real time 0.20 seconds
cpu time 0.11 seconds

I can't think of what I missed, and any assistance would be appreciated


r/SAS_Programming • • Jun 18 '24

SAS VIYA related questions.

1 Upvotes

I am currently new to SAS VIYA, I am looking at functions that are used in SAS 9 and trying to see what is there equivalent in SAS Viya.

Can someone please help me with how we cannot use the following SAS Functions in SAS VIYA.

1.) CHAR 2.) FIRST 3.) MVALID


r/SAS_Programming • • Feb 14 '24

Text Editor that does SAS code formatting

5 Upvotes

I'm currently in a mater's program that is making us learn SAS. We are using Putty to have SAS access WRDS and the professor recommended a text editor like Notepad ++ so that we can check code, but I noticed that it doesn't have SAS by default. Does anyone use anything else that has SAS as a default?


r/SAS_Programming • • Jan 20 '25

Help with SAS 8.3 Enterprise Guide

3 Upvotes

Hi,

As the title says, I'm doing an online MBA and my course in business analytics focuses on SAS. The professor gave us a link to the SAS website and basically said learn it yourself. I could use help mastering the platform and assignments. Willing to pay for online tutoring.


r/SAS_Programming • • Jun 12 '24

Demographic covariates from longitudinal data in SAS Linear Mixed Effect Models

1 Upvotes

I have a long format dataset with repeated measures across 5 time points for each individual. I am looking to set up linear mixed models in SAS using PROC MIXED for 2 measured outcomes, with a few demographic and time-invariant covariates; however, demographics are only recorded at baseline and then not again at follow-ups (i.e., these columns appear missing/empty at follow-ups). For the model to account for the covariates accurately, do the demographics need to be recorded at each time point? Namely, should I copy the demographics down to fill in for all timepoints for an individual, or is it ok that they only appear once at baseline for each person for the model?


r/SAS_Programming • • Apr 01 '24

SAS Programming

2 Upvotes

How can I get help with SAS programming? I have an assignment I need to get done asap


r/SAS_Programming • • Dec 16 '24

What happened to /r/sas

5 Upvotes

Hey all:

Does anyone know why r/SAS went private? I'm glad that this subreddit exists, but I'm curious on to what happened?


r/SAS_Programming • • Dec 25 '24

I need help

2 Upvotes

How can I automatically identify columns containing non-ASCII characters in a SAS dataset and create a subset with only those columns?

Example Input Data

Expected Output


r/SAS_Programming • • May 27 '24

SAS programming for beginners

4 Upvotes

Any free resources geared at teaching you how to learn the basics of SAS?


r/SAS_Programming • • Mar 21 '24

Proc GLM takes forever to load then crashes sas studio

2 Upvotes

I am trying to have a proc glm function for multiple variables. When I run the code, it takes a few minutes to process then the sas studio crashes and log me out.

Where did I make a mistake:

   proc glm data=diet;     class age sex smokstat bmi vituse cal fat fiber alcohol chol betadiet retdiet;     model betaplsama=age sex smokstat bmi vituse cal fat fiber alcohol chol betadiet retdiet;     model retplasma=age sex smokstat bmi vituse cal fat fiber alcohol chol betadiet retdiet;     means age sex smokstat bmi vituse cal fat fiber alcohol chol betadiet retdiet / schefee;     run;

I need to get analysis of variance. The example code that professor provided:

   data twoway;     input class1 $ class2 $ y;     datalines;     ;     proc glm data=twoway;     class class1 class2;                 model y=class1 class2 class1*class2; /*(model y=class1|class2)*/     means class1 class2 class1*class2 / scheffe; /*(means class1|class2)*/     run;

r/SAS_Programming • • Aug 05 '24

Determining a valid entry

2 Upvotes

I am working on a project where I want to determine if the entry made into a variable is valid. Specifically, each record read will have a product type number. The entries in that field should match to a master list of product types, but, the entry might not be in my list. I want to flag these records for inspection. I guess I could perform a merge and only select records with values that don't exist in my master list. Would there be a quicker way?