Since there is a blizzard and I’m inside analyzing data, I thought it was a good time for another random SAS tip.

The default output type for SAS 9.4 is HTML, which is nice for presentation and sharing, but sometimes I would like a plain text output, especially if I’m going to be doing something like copying and pasting the output into my program.

You can easily toggle between plain text and HTML output by doing this

Go to the TOOLS menu, select OPTIONS and then PREFERENCES.

In the Preferences window, click on the RESULTS tab.

window with listing preference


Check the box next to Create listing and uncheck the box next to Create HTML . Click OK.

Now your results will be in plain text output instead of HTML. To switch back, just go through the same steps, uncheck the listing box and check the HTML box.

Speaking of copying your output into your program ….

I wrote previously about a problem where  I needed to do, among other things, a PROC CONTENTS with the variables in the order they occur in the dataset, not alphabetical order (use varnum) .


If you just copy and paste the output of a typical CONTENTS procedure and all you want is the variable names,  you will have a lot of stuff about data type, length and label that you need to delete. Also, my life experience has been that the keystrokes you make (including the backspace key), the more likely you are to make mistakes. When it comes to the keyboard, less is more.

What I really want is the variables output in the order they appear and nothing more. The SHORT option does this for me.

proc contents data= in.sl_pretest varnum short;

and produces this output

Which_choice_is_the_same_as_the What_is_five_time_six__ Fred_walked_for_one_hour__How_ma How_is_nine_thousand__thirty_sev There_are_124_students_making_th
Valerie_has_225_pennies__She_div Joe_did_this_division_problem Which_sign_goes_in_the_space_to

What possible good is that mess? Well, I copy and paste it under the RENAME keyword and then hit the spacebar between each variable name and type = q1   , or whatever number,  like so


Which_choice_is_the_same_as_the = q1

What_is_five_time_six__  = q2

Fred_walked_for_one_hour__How_ma = q3


As I mentioned in the previous post, I could not do this using an array statement because the data were of mixed type, character and numeric, and SAS does not accept data of mixed types. I also mentioned how to get around that so if you are interested, go back and read that post.


Name (required)

Email (required)


Speak your mind


WP Themes