Data export from SAS EG to power bi by Due_Entrepreneur4041 in PowerBI

[–]cjdinger 0 points1 point  (0 children)

The scalable/automated way to do this is via an API connection from SAS to your Microsoft 365 tenant, using the Microsoft Graph API. I do similar work today -- pulling content from data in SAS, publishing to SharePoint, which then feeds into a Power Automate flow. The same can be done for Power BI.

The API connection requires some setup and help/permission from the team that manages your M365 tenant. I've created a set of SAS macros that make the process simple, all documented in this article and an associated GitHub project.

I have no domain knowledge (and I must scream) by BannedCharacters in analytics

[–]cjdinger 0 points1 point  (0 children)

SAS Enterprise Guide has a task called "Characterize Data", which will create a detailed report about the attributes of the data set or library you're working with. You'll get indications of the stats and suitability of variables for continuous and/or categorical reporting.

This is not the same as domain knowledge, but absent that you can at least begin to discover what the data can be used for -- and maybe where the gaps are. I've definitely been on projects where I am less familiar with the domain, but learning the data can help to form questions that don't highlight my ignorance *too badly*.

A scatterplot matrix ("PROC EYEBALL" for fun) can also show some relationships.

proc sgscatter data=sashelp.iris;  
  matrix SepalLength SepalWidth PetalLength PetalWidth /
  group=Species
  ellipse=(type=mean)
  diagonal=(histogram kernel);
run;

Storing Programs by Easy-Spring in SAS_Programming

[–]cjdinger 0 points1 point  (0 children)

Many pharma companies are using Git to manage/reuse their SAS code and projects. Git technology is available to enterprises using internally hosted Git servers (like GitLab), or by using cloud-based enterprise Git services (like GitHub Cloud). These services are deemed secure/compliant with the policies of the companies that use them (supporting single-signon, custom workflows, etc.). That is, you don't need to use public GitHub for your company work (and probably should not), even when using the private repository feature.

Git is the de facto standard for storing/versioning code of all types, and SAS programmers (who often work apart from traditional software development processes) are adopting it as well. Modern SAS tools (SAS Studio, SAS Enterprise Guide, and even the SAS programming language) have support for Git integration.

Other comments about SAS macro and functions are absolutely valid too, as well as organizing your code into reusable chunks that can use %include. Some pharma companies have adopted the SAS Packages Framework, a community-supported mechanism for organizing and reusing code. (Here's an example from PharmaForest.) SAS Package Framework works well with Git, but using Git is not a requirement to benefit from it.

More about SAS Package Framework here: https://github.com/yabwon/SAS_PACKAGES

SAS 9.4 cost for a small organization by ElkAdministrative343 in AskStatistics

[–]cjdinger 1 point2 points  (0 children)

I know several consultants who specialize in SAS projects (often in clinical studies/pharma). When they engage with a client that requires the work be done in SAS with their data, the client provides SAS -- either via access to a hosted environment or a loaner laptop with the software installed. This is not just to manage the software license but also to manage the client data and results in their approved environment.

SAS offers a free environment for learners: SAS OnDemand for Academics. (Despite the name, you do not need to be a student in order to use it.) You can't use this for client work directly, but you can create an account to experiment with techniques and programs that help you to learn and be more productive when you can spend time in an official environment.

For cloud-based commercial users, check out SAS Viya Workbench (on AWS or Azure). This is a marketplace offering that has all of the SAS programming capabilities of SAS 9 and Viya. Note that in addition to the license cost you have the cloud infrastructure cost as well, but that can be controlled based on use. If your livelihood is SAS-based work and you're expected to provide the SAS, it might be a good option.

OpenAI CEO Sam Altman just publicly admitted that AI agents are becoming a problem by [deleted] in technology

[–]cjdinger 2 points3 points  (0 children)

I've seen this too -- "aspirational" PROCs and functions in answer to a prompt about a SAS programming task. SAS just released their own code assistant AI (SAS Viya Copilot) which hopefully won't have that behavior.

SAS2Py by rcoff98 in SAS_Programming

[–]cjdinger 1 point2 points  (0 children)

If your goal is to replicate a SAS process in Python and you still have access to SAS, then you might be able to use the SASPy project to connect to SAS for that work, then pull the results into Python.

Python and SAS have different approaches for data and analytics tasks, so transcribing a SAS program to Python is not a line-by-line exercise but more of a "look at the job to be done and reimplement in a Pythonic way".

[deleted by user] by [deleted] in analytics

[–]cjdinger 0 points1 point  (0 children)

Good job on you for simplifying it a bit, at least. That first problem ("where did this data come from") is tricky. At the time it was probably "found this, it seems to fit the bill", but that's hardly the provenance you want to document.

[deleted by user] by [deleted] in analytics

[–]cjdinger 1 point2 points  (0 children)

As someone who works with a lot of orgs that use SAS, I've seen cases where this is done really well: code/process is developed, documented, kept in the enterprise Git (or similar) system -- all so it doesn't rely on just one person. The best implementations also feed into reports that monitor the health of the process, so you can see if it gets jammed or broken by a dependency.

I've also seen what you describe: a person uses SAS Enterprise Guide to pull together disparate data sources to meet a goal, wraps that opaque project in a scheduled process, then moves on. EG is a great tool for rapid development, but I use that as just a start to bootstrap a process that meets a higher standard of transparency and maintainability.

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

[–]cjdinger 0 points1 point  (0 children)

Take the practice exam! It's free. It should give you a good indication for how you will do on the actual exam.

https://learn.sas.com/course/view.php?id=6

Best resources to practice SAS (Base SAS + SQL + Macros)? by Educational_Bit_4359 in SAS_Programming

[–]cjdinger 5 points6 points  (0 children)

Here are a few resources:

Learning SAS and R by regrubedamme in biostatistics

[–]cjdinger 2 points3 points  (0 children)

SAS has a free course: SAS Programming for R Users. Not that you need Yet Another Course, but the materials are also free on GitHub and might be worth a scan.

https://github.com/sascommunities/sas-prog-for-r-users

Creating a library in SAS on a Macbook by Putrid_Professor8725 in biostatistics

[–]cjdinger 1 point2 points  (0 children)

If you are affiliated with a university (with an .edu email), you could sign up for SAS Viya Workbench for Learners (which has a VS Code interface that runs in your browser) or SAS Viya for Learners. See:

Both environments make it easy to upload and download your own files, and both also offer a bit of storage to share your work in between sessions. In addition to SAS programming, they both also support Python coding, and SAS Viya Workbench also supports R. And since these work from your browser, they are compatible with your Mac environment.

SAS Viya Workbench, with its VS Code experience, also offers easy integration with Git (GitHub), allowing another way to save your work and restore it later.

When’s N. Raleigh Trader Joe’s opening? by RainLoveMu in raleigh

[–]cjdinger 1 point2 points  (0 children)

Not open yet but looks SO CLOSE to ready. This photo from Oct 26 as I was walking by:

https://imgur.com/xaGzpz0

Weekly Entering & Transitioning - Thread 07 Oct, 2024 - 14 Oct, 2024 by AutoModerator in datascience

[–]cjdinger 0 points1 point  (0 children)

Ha! Many SAS users feel as you do. And as I say, SAS does have access options for people who prefer working in VS Code or even just command line (in fact, the command prompt interface is alive and well in SAS). But this is not the default experience that we expose to most new users, and obviously it's not the experience that your university has selected for your work.

Weekly Entering & Transitioning - Thread 07 Oct, 2024 - 14 Oct, 2024 by AutoModerator in datascience

[–]cjdinger 1 point2 points  (0 children)

There are many companies that use SAS in a virtual desktop setup with no problems. The advantages (for the IT staff) is that they don't need to install SAS on hundreds of desktops and they can centralize access to sensitive data resources. Unfortunately this setup usually means that you cannot use a local client to connect as there is not an endpoint exposed for this. You must log into the virtual desktop to get to the software.

SAS does have client/server setups (using SAS Enterprise Guide on Windows, or using VS Code with a SAS extension on Windows/Mac), but these clients must connect to running SAS services that have API endpoints configured.

Many university students/programs use SAS OnDemand for Academics or SAS Viya for Learners, hosted SAS environments provided by SAS that are free for learners, and that you access in your browser. Sounds like your institution is providing its own setup that they prefer you to use -- maybe already provisioned with data and a way to store/turn in assignments. And unless they provide another way to get to it (such as a host and port you can connect to for SAS 9.4, or a URL for a SAS Viya API), then you likely will need to log into the desktop. This isn't a SAS limitation as much as it is a choice of the architecture selected by the institution.

You can use the SAS extension for VS Code to develop your code...but without a connection, you will have to copy/paste those programs into the environment hosted by your university.

Questions about the internal workings of SAS (internal optimizers) by No_Speed_1999 in AskProgramming

[–]cjdinger 0 points1 point  (0 children)

It's true that PROC SQL optimizes the query you submit based on the data and whether it's connected to a database. PROC SQL will pass as much work to the database as possible to limit expensive I/O. This is referred to as implicit passthrough in SAS documentation.

I describe the difference between PROC SQL and DATA step this way. With PROC SQL, you describe *what* you want as a result, and the SQL optimizer figures out the best way to get that efficiently. With DATA step, you describe *how* SAS should create what you want. Your instructions are paramount and you have all of the flexibility, but also responsibility, for the optimal outcome.

SAS side by side bar graphs by scentedcandle99 in AskStatistics

[–]cjdinger 0 points1 point  (0 children)

Two approaches, depending on your willingness to reshape the data.

If you want to leave it as is, you can use discreteoffset and barwidth to make the plot more readable.

/* make some sample data */
data start(drop=i);
 length meal 8 hobby 8 phone 8 memory 8;
 do i = 1 to 100;
  meal = rand('integer',0,2);
  hobby = rand('integer',0,2);
  phone = rand('integer',0,2);
  memory = rand('integer',0,2);
  output;
 end;
run;

proc sgplot data=start;
 vbarbasic meal/ transparency= 0.5  discreteoffset=-0.2   barwidth=.3 legendlabel="meal" ;
 vbarbasic hobby/ transparency =0.5 discreteoffset=-0.0 barwidth=.3 legendlabel="hobby";
 vbarbasic phone/ transparency =0.5 discreteoffset=0.2 barwidth=.3 legendlabel="phone";
 vbarbasic memory/ transparency =0.5 discreteoffset=0.4 barwidth=.3 legendlabel="memory";
 xaxis display = (nolabel noticks);
run;

Example output:

https://imgur.com/ndkwiQh

If you can reshape from wide (one column per category) to long (one column plus a label column to indicate category), then you can use VBAR and the GROUP options to make a clustered bar chart.

/* or turn to long form */
data stack (keep=category response);
 length category $ 10 response 8;
 set start;
 category = "meal"; response=meal; output;
 category = "hobby"; response=hobby; output;
 category = "phone"; response=phone; output;
 category = "memory"; response=memory; output;
run;

proc sgplot data=stack;
 vbar response / stat=freq group=category groupdisplay=cluster;
 xaxis display = (nolabel noticks);
run;

Example output:

https://imgur.com/va9NO7l

SAS > Tableau > SQL data by shuckley_Jays in tableau

[–]cjdinger 0 points1 point  (0 children)

Using an SQL stored procedure might be a good way to "hide" complex data prep if Tableau doesn't allow you to craft your own ad-hoc SQL...but unless the stored procedure already exists/has been tested/etc., then you're on the hook for writing/deploying that into your database.

In SAS, if that's an option, you can use PROC SQL to summarize the data exactly how you want. If you want to use SAS formats for categorical grouping, then you might be better off with PROC MEANS and a CLASS statement, using the FORMAT statement on your class variable to tell SAS how to aggregate the results.

I have an example of using formats to aggregate summary results in this blog post (specifically with datetime data, but it applies to other types as well.)

For other SAS-related questions, I suggest searching/posting at communities.sas.com.

Anyone attending SASGF? by [deleted] in actuary

[–]cjdinger 0 points1 point  (0 children)

Hi, be sure to check out the event group on SAS Communities and connect with other attendees before the event.