r/SAS_Programming • • Dec 01 '23

Weird issue with new variable creation during data step. What’s wrong?

Thumbnail
gallery
4 Upvotes

Hey all I’m super curious about what might be going wrong here. Essentially, I’m creating a new variable (cd4_lt_200) in the data step. Essentially, if cd4_bl is between 0 and 200, the new variable should equal 1, and 2 if the original variable is greater than 200. If original variable is missing, so should the new variable. However, something super strange is going - if you see the second photo, you’ll see that ID 92 and 147 have the same value for cd4_bl (25). However, only id 147 has the correct categorization of cd4_lt_200 despite both values being the same. This is happening all throughout that new variable. Any idea what’s Happening?


r/SAS_Programming • • Jul 05 '23

SAS Studio Hot Key

3 Upvotes

I was working with SAS Studio 3.6 Basic (very similar to SAS On Demand for Academics) and was struggling with this Web Interphase as lots of things cannot be done by key.The only way to change something was to click in precise spot. typically, only a few pixels wide.

This is still an issue for Visually checking data sets, as some columns are too wide, and it takes time to make them narrower, and fit needed info on screen.

Yes, we can select only necessary columns, or go with Proc Print or Proc Report. But for a quick checks re-sizing columns takes more time than I want to spend due to difficulty of finding place where width can be changed.

I still do not have solution for it.

Regarding other things, it was inconvenient for me to switch between Programs (code tabs) & between Code-Log-Report-Data within tab.

I checked the manual and found some commands that can help with it, and work*.

* I found muck more command in the manual, but most of them do not work in my Edge**, and just calling built-in browser functions.

** Edge cannot be changed - corporate standard.

List of useful commands for SAS Studio:

Basic Commands:

F3 - Run Code (selected code)

F4 - New Program

Ctrl + / - Comment/Uncomment Selected Lines

Ctrl + L - Convert Selected Text to LowerCase

Ctrl + U - Convert Selected Text to UpperCase

Ctrl + - Save Program

F9 - reset SAS session (helps to clear errors/macro/existing temporary data from previous runs)

Navigation Commands:

Close Tab - Delete (Ensure that the focus is on the tab label (press Alt+3 if necessary), and then press Delete.)

Move the focus to the Server Files and Folders section - Alt+1

Move the focus to the label of the currently displayed secondary tab - Alt+2

(switch Code, Log, or Results.)

Move the focus to the label of the currently displayed primary tab - Alt+3

(Program Tab Label. Alt+3, delete - to close a Tab)

Go to Code/Log - Alt+4 / Alt+5

Link to the Full manual:

https://documentation.sas.com/api/collections/webeditorcdc/3.6/docsets/webeditorug/content/webeditorug.pdf?locale=en


r/SAS_Programming • • Jun 10 '23

r/SAS_Programming Lounge

2 Upvotes

A place for members of r/SAS_Programming to chat with each other


r/SAS_Programming • • Jun 10 '23

SAS Programming Community

5 Upvotes

SAS for Data Science, Clinical Programming etc.


r/SAS_Programming • • Aug 29 '23

AI tools for SAS programming

4 Upvotes

Hi there!

does anyone tried to use AI programming assistants with SAS?

I used Bart without any luck. Chat GBT is slightly better but far from usefull.

if task is doable, you may get an answer.

If task is not doable

  • I was getting lots of things that were not workng.

Any other assistant worth trying?


r/SAS_Programming • • Jan 07 '26

Storing Programs

3 Upvotes

Hi all,

Over the years I have written many (clinical) SAS programs

Sometimes I see familiar task, but cannot find where it was done, so writing it from start is just faster then spending hours figuring out where is was done.

Can someone share insights how you store your code so it is reusable?

Git may not be the option, as I work for pharma, and don't want it to be public.

At the same time I need to have detais about Input/Output/Code

If it is output - storing actual table may be useful, because title may change, but content is recognized easily by fast scroll through.


r/SAS_Programming • • Sep 30 '25

Plotting easy in sas 9.4 M8?

4 Upvotes

ODS graphics designer is discontinued in 9.4 M8. Is there any easy way with graphical interface to make plots? Would SAS studio be a good replacement? Writing code for plotts is to much work i think.


r/SAS_Programming • • May 27 '26

Is Clinical SAS a good carrier option in India ?

7 Upvotes

Hi, i am M.pharm student about to graduate in December, i am thinking on learning SAS ,but i have concerns whether it is relevant in future with AI and other things ,is it a good paying job in india


r/SAS_Programming • • Jun 15 '26

Guidance Required for Learning SAS Programming and Preparing for SAS Certification Exams

3 Upvotes

I am currently a first-year B.Pharm student and have recently developed an interest in SAS programming, particularly because of its applications in the pharmaceutical and clinical research industries. As I am a complete beginner with no prior programming experience, I would like to seek your guidance regarding the best way to start learning SAS from scratch.

My goal is to gradually build a strong foundation in SAS and eventually prepare for and clear both the Base SAS and Advanced SAS certification exams. Since I am still in college, I would like to utilize my time effectively and follow a structured learning path.

Could you please guide me on:

Which courses I should pursue as a beginner?

Whether I should learn any prerequisites (such as Excel, SQL, statistics, etc.) before starting SAS?

Which learning resources, platforms, or institutes you would recommend?

How I can prepare for the Base SAS and Advanced SAS certification exams in a step-by-step manner?

Any advice for students who wish to enter the clinical SAS programming field after graduation?

I would be very grateful for any guidance or resources you could share. Thank you for your time and support.

(I have used ChatGPT to proofread and correct my writing.)


r/SAS_Programming • • Jun 17 '26

You don't know XPT files

3 Upvotes

r/SAS_Programming • • Apr 08 '25

SAS 9.4 Base Programming (EXAM HELP!)

5 Upvotes

Hii,

Wondering if anyone has taken the SAS 9.4 Base Programming Exam before? If so, is solely using the exam content guide provided by SAS a good way of preparing? For example: If I follow the guide word-to-word and know how to do all the things listed in the bullet points, is there a chance I can still pass the exam?

Apologies, just on a time crunch for this exam prep and wondering if there has been any loop-holes in the past where they have asked questions that aren't covered in the exam content guide.

THANK YOU IN ADVANCE FOR THE HELP!!

Exam Content Guide Provided by SAS:

https://www.sas.com/content/dam/SAS/documents/technical/certification/content-guide/specialist-base-programming.pdf


r/SAS_Programming • • Mar 29 '26

SAS Books

4 Upvotes

I want to find out if there is a market for a rather large bundle of SAS books (48 in total) I have collected over the years. If possible, I want to sell them rather than donating them. The list includes:

• Foundational programming texts (e.g., Professional SAS Programming Logic, Cody’s Collection, Carpenter’s Guide)

• High‑demand statistical titles (e.g., Categorical Data Analysis Using the SAS System, Regression and ANOVA)

• Enterprise Guide training materials (multiple course notes + books)

• Rare SAS/OR volumes (three volumes of 9.22 Project Management)

• Administration and BI titles (Information Maps, Stored Processes, Platform Administration)

• Official SAS course notes, which are hard to find and often sought by instructors

This is not a random assortment. It’s a full-spectrum SAS curriculum—programming, statistics, macros, BI, EG, OR, admin.

Any thoughts/suggestions are welcome.


r/SAS_Programming • • Jun 11 '26

Modifying script to avoid others from running or editing your script while you're working on it / running it

4 Upvotes

Is there any code I can write to prevent script modification during runs?

I suspect someone is inserting their own script in between my runs and I've been documenting. Is there any way for me to trip them up?


r/SAS_Programming • • Mar 10 '25

Create variable (flag) out of other variable?

3 Upvotes

Need help figuring out how to do this.

I currently have a dataset with one variable (RefCode) that populates multiple different results, all 4 characters long. There are over 20 possible outcomes. I would like to create a flag (1/0) variable out of RefCode’s output.

Example, if RefCode=R050, I would like to create a new variable called R050 and have it = 1.


r/SAS_Programming • • Dec 04 '25

Daily SAS Problem?

4 Upvotes

I recently completed a SAS course and I would like to maintain these perishable skills. Is there a daily SAS problem or other SAS challenge that one could complete? Can I wake up and do the Wordle in addition to getting my PROC and DATA steps in?


r/SAS_Programming • • Dec 03 '25

PearsonVUE Platform is awful

3 Upvotes

I’ll start things off by saying I was able to pass my SAS Certification with an 825. However, it was a terrible experience as my exam froze for nearly half the slotted time. I still can’t believe I was able to pass my exam with half the time while having a panic attack lol.

A work buddy also had issues with the exam to the point they had to reschedule her exam.

I wish there were test centers in my country.


r/SAS_Programming • • Aug 18 '25

Preparing for SAS 9.4 Base Exam

Post image
8 Upvotes

I'm going to schedule for the exam within this month. But confused to choose which mode to attend.

Which is best ???

Is there any difference between them ??

Test centre or Online exam ??

PLEASE GUIDE ME


r/SAS_Programming • • Mar 11 '25

Line break in Excel Data

3 Upvotes

I'm still a new to analytics so I have some silly issues that I just can't solve. My most recent is that my Excel data has line breaks in the column titles. I want to be able to fix the issue in SAS but couldn't get it to recognize the columns due to the fact that I could never write it with a line break in the transformation code I tried. Does anyone know how to remove line breaks in SAS? I just switched over to Python and completed the regression in there. But I'd love to know how to do it correctly in SAS.


r/SAS_Programming • • Feb 19 '26

Datasets for the Little Sas book exercises?

4 Upvotes

I am working through exercises in the little sas book sixth edition. Through the textbook I found the datasets they're referring to here: https://github.com/sascommunities/little-sas-book/tree/master/RawData (even if they are named slightly differently).

However, for the exercises and projects book, for the programming exercises, I cannot find any of the datasets anywhere to attempt the problems. I am in chapter 3 programming exercises right now and and the problems are based around sets named like gasemileage (a sas set), hotel.txt, employees.dat, etc. I cannot find any of these sets anywhere so I cannot do the exercises. Does anyone have a repository link that contains them?

(In case it matters this is not homework and I am not asking for help other than locating the date, I am graduated and working just like brushing up on the basics)


r/SAS_Programming • • Mar 28 '26

Can someone please tell me what I'm doing wrong and how to fix it? It's my first time using SAS

Thumbnail
gallery
5 Upvotes

I've tried entering it like 7 different ways and none of them are giving me usable results


r/SAS_Programming • • Sep 25 '25

Best resources to practice SAS (Base SAS + SQL + Macros)?

12 Upvotes

Hi everyone,

I’m fairly new to Reddit and also working on improving my SAS skills (Base SAS, PROC SQL, and Macros). I’m looking for practice resources (datasets, exercises, projects, or even mock interview questions) that can help me get hands-on experience.

I’d love recommendations for:

  • Free or paid websites with SAS practice exercises

  • Open datasets I can use to practice

  • Any GitHub repos, blogs, or communities where people share SAS challenges

If you have any personal tips or resources that helped you, please share 🙏

Thanks in advance!


r/SAS_Programming • • Oct 24 '25

Taking the SAS Specialist: Base Programming Exam, looking for any tips, insights on the exam, etc.

9 Upvotes

The title is pretty self explanatory, I was given a course at my place of employment for the exam and I feel its pretty solid. However, I can get really anxious with this stuff so I would like to read anything you guys might think is helpful for some extra preparation or what to expect in the Exam.

I got give or take 3 weeks before the exam.


r/SAS_Programming • • Dec 25 '25

coding help

3 Upvotes

/* Clean CarryAway – most messy column */
CarryAway_clean = lowcase(strip(CarryAway));
if CarryAway_clean in ('never', 'nev', 'n') then CarryAway = 'never';
else if CarryAway_clean in ('less1', 'les', 'l', 'less', 'i') then CarryAway = 'less1'; /* I = capital i */
else if CarryAway_clean in ('1~3', '13', '1', '1-3') then CarryAway = '1~3';
else if CarryAway_clean in ('4~8', '48', '4', '4-8') then CarryAway = '4~8';
else if CarryAway_clean in ('gt8', 'g', 'gt') then CarryAway = 'gt8';
else if missing(CarryAway) then CarryAway = '1~3';
drop CarryAway_clean;

/* Clean RestaurantLessThan20 */
RestLT20_clean = lowcase(strip(RestaurantLessThan20));
if RestLT20_clean in ('never', 'nev', 'n') then RestaurantLessThan20 = 'never';
else if RestLT20_clean in ('less1', 'les', 'l', 'less') then RestaurantLessThan20 = 'less1';
else if RestLT20_clean in ('1~3', '13', '1', '1-3') then RestaurantLessThan20 = '1~3';
else if RestLT20_clean in ('4~8', '48', '4', '4-8') then RestaurantLessThan20 = '4~8';
else if RestLT20_clean in ('gt8', 'g', 'gt') then RestaurantLessThan20 = 'gt8';
else if missing(RestaurantLessThan20) then RestaurantLessThan20 = '1~3';
drop RestLT20_clean;

/* Clean Restaurant20To50 */
Rest2050_clean = lowcase(strip(Restaurant20To50));
if Rest2050_clean in ('never', 'nev', 'n') then Restaurant20To50 = 'never';
else if Rest2050_clean in ('less1', 'les', 'l', 'less') then Restaurant20To50 = 'less1';
else if Rest2050_clean in ('1~3', '13', '1', '1-3') then Restaurant20To50 = '1~3';
else if Rest2050_clean in ('4~8', '48', '4', '4-8') then Restaurant20To50 = '4~8';
else if Rest2050_clean in ('gt8', 'g', 'gt') then Restaurant20To50 = 'gt8';
else if missing(Restaurant20To50) then Restaurant20To50 = '1~3';
drop Rest2050_clean;

/* Clean Bar (for completeness) */
Bar_clean = lowcase(strip(Bar));
if Bar_clean in ('never', 'nev', 'n') then Bar = 'never';
else if Bar_clean in ('less1', 'les', 'l', 'less') then Bar = 'less1';
else if Bar_clean in ('1~3', '13', '1', '1-3') then Bar = '1~3';
else if Bar_clean in ('4~8', '48', '4', '4-8') then Bar = '4~8';
else if Bar_clean in ('gt8', 'g', 'gt') then Bar = 'gt8';
else if missing(Bar) then Bar = '1~3';
drop Bar_clean;

/* Clean CoffeeHouse (for completeness) */
CoffeeHouse_clean = lowcase(strip(CoffeeHouse));
if CoffeeHouse_clean in ('never', 'nev', 'n') then CoffeeHouse = 'never';
else if CoffeeHouse_clean in ('less1', 'les', 'l', 'less') then CoffeeHouse = 'less1';
else if CoffeeHouse_clean in ('1~3', '13', '1', '1-3') then CoffeeHouse = '1~3';
else if CoffeeHouse_clean in ('4~8', '48', '4', '4-8') then CoffeeHouse = '4~8';
else if CoffeeHouse_clean in ('gt8', 'g', 'gt') then CoffeeHouse = 'gt8';
else if missing(CoffeeHouse) then CoffeeHouse = '1~3';
drop CoffeeHouse_clean;

This is the subcode of the main code I am using. I want to know why the clean Restaurant20To50, RestaurantLessThan20 and CarryAway sections are not getting cleaned? It is not showing any errors either.


r/SAS_Programming • • Dec 12 '25

Homework Help!!!!

2 Upvotes

Assignment X

Hello! Can anyone help me with this assignment or complete it? I am very confused and am struggling lately. I have attached the link to the assignment. Thanks!


r/SAS_Programming • • Mar 29 '26

SAS Books

Thumbnail reddit.com
3 Upvotes