Learning SAS (University; LinkedIn; 9.4; Certification) – Part 01

Over the years, I’ve wanted to learn SAS. While at USC, I heard about SAS University, which originally required downloading software onto something like a Virtual Machine (I used VirtualBox). Recently, everything has shifted to online, which makes life easier.

LinkedIn Learning (formerly Lynda.com) has a bunch of intro to SAS Programming courses towards a Basic Programming certification (SAS 9.4 Certification)

I’ll be creating blog posts for each of the lessons. The basic steps I’ll be following are: Access Data; Explore Data; Prepare Data; Analyze and Report on Data; Export results.

My immediate thought is that SAS will be useful for analyzing data that I’m researching regarding women in aviation. There are a series of datasets from the FAA.

SAS Programming Interfaces

SAS Studio
-This is a web-based interface between end-user and SAS
-Basics needed for programming (editor; messages – log; review output, reports, etc)

Browsing data within SAS Studio
-Libraries (on left pane)
-My Libraries (click on the twistie)
-SASHelp (various Sample SAS tables)
-CLASS Table – This opens, on the right, a bunch of columns and rows of students (age, height, etc)
Note: It’s easy to select/deselect columns, and also move the column selector to the left for more space.
-To recreate “Program 1” – 7 blips icon (New Options), New SAS Program (F4)

-Initial sample code – reads sashelp.class and enters into myclass
data myclass;
TAB set sashelp.class;
run;

proc print data=myclass; — prints the myclass table
run;

After running, I have my table (columns, fields). I also have ability to look at: code; log; results; output data. Code is the program I just entered. Log gives a summary of what happened, including total CPU time used, etc and “Errors, Warnings and Notes”. Results is the table that was outputted. Output Data is what I originally had when I opened the sashelp.class table.

Size grid columns to content. This is a way of minimizing the field width, so you see more data on the screen. In Output data, either right click and select that, or you can set in preferences.

To run specific parts of the code:
-Select the lines you want

Have “Results” off to the side:
Drag Results to the right until the little icon turns green. It’s also obvious when it shades a block on the right. You can reverse by dragging results back to the where you started from.

SAS Syntax
-SAS Program is a sequence of steps
-DATA step or PROC (Procedure) steps
-The step will begin with either data or proc
-The steps will typically end with a “run;” statement
-In general, a data step reads data from input source; processes it; and creates a SAS table
-A data step may also filter, compute new columns, join tables, etc
-A proc step can generate reports, graphs, compute stat and analysis.
-All statements must end with a ;
-Some statements only have key words within the step, but may have something that are assignment statements
-Global Statements — outside of data and proc steps. Typically define option or settings for SAS session. Global statements do not need a run; statement after them

-Comments: For multiple lines of a comment — begin with /* and end with */
-Comments: To comment out a single line, lead with a “*”
-Comments: One way of creating a comment is: write the comment; select it; press “Command, /”

-Formatting the code: Ideally you have a blank line between steps. Also, use tabs to indent stuff. If you haven’t done this, there is a handy button called “Format code” that will do it for you. In the editor, the comment is in a green color

-Syntax Errors – finding and resolving: These are just a fact of life in programming. Misspelled keywords, unmatched quotation marks, invalid options, missing semicolons. SAS enters warning or error in log.
-Suggestion: Always look at the Log after running, and review from top to bottom. Look for obvious errors, including just before the highlighted line.

Posted in Programming, SAS | Leave a comment

Limiting WordPress revisions

I’ve noticed that, within one of my blogs, that when I routinely update a page, I now have over 200 revisions. I’m sure this is taking up space somewhere.

I only need the last 3 revisions, that I can think of for right now.

Here’s info from WordPress on this.

Looks like I have to edit the wp-config.php and place:

define( ‘WP_POST_REVISIONS’, 3 ); — this will keep it to the last three revisions.

Question: After updating this in wp-config.php, does it automatically remove all those prior revisions?
Answer: No. You have to either run a SQL command or install a plugin like WP Optimize

I also found this reference, that may be about how to clean up prior posts. I’m also not positive if all this is about posts and pages.

Resolution: I downloaded a plugin called WP Optimize. It does more than I need, but I deleted (one click) about 749 old revisions of posts.

Posted in Blog Learnings, Management, Web Development, WordPress | Leave a comment

XCTC – Day Twenty Five (Sun) – Last day; packing up; pallet jacks

Last Day
-Well… That’s it. Interesting experience, but unlikely I’d repeat it.

Packing Up
-Everything had to be stowed back into boxes and then loaded into trucks.

Pallet Jacks
-Have never used a pallet jack, so that was an experience fitting everything in precisely to the truck.

Shemagh
-Good that I had this on, as the wind really picked up in the afternoon.

Posted in XCTC Program | Leave a comment