Watch this Ask the Expert session to explore the many features available at your fingertips when using SAS.
You will learn:
The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached.
Q&A
Could you please show me how to use these functions, such as libraries, for snippets and macros in SAS window view? I don't have SAS studio. Thanks
In the SAS windowing environment, you cannot use code snippets. However, you can save SAS source code that you commonly use to a SAS catalog and open it into an editor when needed.
Example:
name.
To set up libraries, open the New Library Window (Explorer window), right-click and choose "New" to create a new library. You can name your library (e.g., "Point") and browse to a data location (for example, C:\Webinar Data Sets). You can reference existing data sets or create a new folder. If you want to create permanent data sets, use the library reference that you up. Next, click the check box entitled "Enable at startup" to have your library reference automatically activated whenever you start SAS.
Can you do SAS programming interfaces on SAS Viya?
Yes. SAS Studio is the interface for submitting SAS programs in Viya.
You can also use Enterprise Guide and SAS Windowing. See videos:
https://www.youtube.com/watch?v=13hgRXmFD7E&t=1280s
How does CAS work in SAS Viya? I need interface to see.
Please see the following videos: SAS Studio on SAS Viya - SAS Video Portal
There is also a Free SAS Overview Course: Free Online Training | SAS
How do I copy variable name in SAS Studio? In previous SAS Base 9.4, I directly click on variable column name to copy. But in SAS Studio that does not happen.
Yes, it works in SAS Studio 8.3 .
Expand a table and columns of choice under libraries. Next, click and select one or columns and drag them to the editor.
Are snippets available in egp?
Yes. Select Program->New Snippet.
What is the use of debugger? As I’m a programmer, I do not actually use this.
The Debugger is excellent in seeing the execution of the Data Step one iteration at a time and seeing values changes for columns per record. This is very useful in helping to solve logic errors.
In SAS Studio, how do I change font size in results window?
In Studio, you can maximize or un-maximize the window. In reference to the actual report, you can use the style attributes option. For more information, please see the online documentation: SAS Help Center: Use ODS Styles with PROC PRINT
Here is an example using Proc Report:
proc report data=sashelp.class nowd headline
style(header)=[fontsize=15]
style(column)=[ fontsize=5]
style(lines)=[ fontsize=5]
style(summary)=[ fontsize=5 ];
column Name Sex age weight ;
Run;
You need to select the common columns, right?
You have that option yes. For example, in the following Proc Print example with style syntax:
proc print data=exprev noobs sumlabel='Total' GRANDTOTAL_LABEL="Grand Total"
style(table)=[frame=box rules=groups]
style(bysumline)=[background=red foreground=linen]
style(grandtotal)=[foreground=green]
style(header)=[font_style=italic background=orange];
by sale_type order_date;
sum price quantity;
sumby sale_type;
label sale_type='Sale Type' order_date='Sale Date';
format price dollar10.2 cost dollar10.2;
var Country / style(data)=[font_face=arial font_weight=bold background=linen];
var Price / style(data)=[font_style=italic background=yellow];
var Cost / style(data)=[foreground=hgt. background=lightgreen];
title 'Retail and Quantity Totals for Each Sale Type';
run;
Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars.
I posed a question during this webinar that was not addressed here. I'm paraphrasing at this point but given that a lot of git-enabled projects usually involve developing code on a local clone of a repository, there is a need to call on relative paths to correctly reference objects within the repo's structure (e.g., %INCLUDE or FILENAME statements). Is there a pan-environment, code-driven solution for achieving relative path references in SAS that improves the "portability" of a SAS code base? I work exclusively on a local machine instance of SAS 9.4. Thank you for the information!
@LukeDalton - We use full folder paths for our Git repository directories by creating a macro variable that points to the required repo's root directory, then use that macro variable in all subfolder path definitions. Changing to a different repo is as easy as changing the root directory macro variable.
We find that works reliably and transparently for us as long as you are disciplined about using that macro variable. The problem with relative paths is where is the starting directory? If could be a user directory or it could be the folder where your SAS executable is depending on how your SAS installation is configured.
@john_mccall Thank you for that resource. I appreciate it!
@SASKiwiWe currently use a similar approach with macro variables pointing to shared directories, which works well for static locations such as shared datasets or reference files. The challenge I’m running into is specific to collaborative Git workflows (cloning, branching, pulling, and pushing). For version control to function smoothly, I need a way to reference files relative to the location of the local clone of the repo, so the code always pulls from the correct version of each source code file, especially when working on branches where file versions may diverge from the central or "main" branch.
Relying on hard-coded paths means any change to those macro variables would have to be staged and committed, which could clutter the Git history and create unnecessary merge conflicts around those %LET statements.
Ideally, I’m looking for a way for SAS to treat the directory of the currently executing .sas file as the starting point, so I can reference adjacent folders using patterns like "./" or "../", similar to how many other languages/terminal handle relative paths.
I am aware of the following methods:
%SYSGET(SAS_EXECFILEPATH) in Batch/Display Manager Sessions&_SASPROGRAMFILE in EG/SAS Studio/VS Code SessionsBut both approaches have limitations. They don’t lend themselves to easy traverse to parent directories, and they differ depending on the environment, which complicates things.
@LukeDalton Late to this, but I'll share what I do. I use environment variables to set root paths (the %SYSGET approach) so my EG code can run interactively in EG but then work properly when deployed/run in batch (in my case, via cron jobs on Linux). All of my code is also managed in Git for backup, versioning, and business continuity.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →Ready to level-up your skills? Choose your own adventure.
Your Home for Learning SAS
SAS Academic Software
SAS Learning Report Newsletter
SAS Tech Report Newsletter