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.
Copying data structure
Q: How do I copy the data structure of a previous data set without reading any rows?
A: You have to know the difference between compile and execute statements. The if zero statement is not executed, but it is compiled, which reads the data structure and fills the PDV (Program Data Vector) with the named data set. No values are initialized and no rows output.
Note: Using this trick will keep you from having to use the force option in Proc Append.
DATA Work.Previous; attrib VarA length = 4; stop;
DATA Work.ProcThisStuff; if 0 then set Work.Prev;*copy data structure; attrib LocalProcVar1 ...;
Proc SQL; create table Work.Current like Work.Previous;
- wiki pages
- SUG papers
--macro maven == the radical programmer 16:19, 27 October 2008 (EDT)