As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Solutions in the Round -- How to Order the Variables on the PDV

From sasCommunity
Jump to: navigation, search

Introduction

From the WUSS abstract for this topic

A common question among SAS programmers is how to order the variables on the program data vector. We will discuss several methods. Solutions in the Round is an exciting new section [at WUSS 2014]. The format is simple: we sit in a circle and discuss the many ways to approach and address a programming problem, and we'll identify situations where one approach might be more useful than another. We will keep notes, and those notes will be posted on sasCommunity.org where we can continue the discussion and allow other to join in after the conference. We hope to engage users from all different perspectives and experience levels to participate in these discussions.

Discussion at WUSS

Why does it matter?

  • PROC EXPORT -> no var statement
  • data view
  • double hyphen notation: VarFirst -- VarLast
  • proc contents ORDER
ODS OUTPUT ___;
Proc Print ___;
   var ___;
RUN;
ODS OUTPUT CLOSE;

another example

Data x;
   format x y a b c;
   retain ...;
   label; /*must specify labels*/
   length /*must specify length*/
   attrib ...;
   set x;
 
or
 
if 0 then do;
   set ...(keep=var_x);
   set...(keep=var_z);
   set ...(keep=var_y);
end;
 
PROC SQL;
   create view new as
   select ___, ___, ___,
   from ___;
QUIT;
 
DATA ___;
   set ___;
   if _n_=0 then do;
     newvar1=oldvar1;
     newvar2=oldvar2;
     ...
   end;
RUN:
 
PROC COPY in=___ out=___;
   select ___;
RUN;

Another option is to use a dictionary/metafile to create your code for you: www.lexjansen.com/wuss/2014/37_Final_Paper_PDF.pdf

DS2: New 4GL proprietary programming language


Further Discussion -- Open to All

Please join the conversation! Also, if you were one of the live participants, please feel free to correct any mistakes or omissions from our original discussion.

  • First of all, my apologies for the delay in posting this to the site -- several months after the conference. It was a lot of fun to host this section and to collaborate in such a free-formatted section, and I hope that we can continue the discussion here. As the section chair, and in hopes of breaking the ice, I challenged myself to propose the worst solution to every problem. I think that it is important to identify the full spectrum of solutions to a problem, so that we can also identify the things that we are trying to avoid. Also, we can all agree that there is usually not just one solution that fits every single problem. I look forward to hearing others' thoughts. Cheers, --Otterm1 (talk) 10:58, 30 December 2014 (CST)