LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 12 Jul 2008 07:05:37 -0700
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Organization: http://groups.google.com
Subject:      Re: SAS/AF: Copy and Paste into Table Viewer from Excel
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

data_null_,

Definitely works for me! My code then reduces to:

filename ft44f001 dde 'clipboard' notab lrecl=32768; filename ft45f001 temp;

*** Find the last column number of the selection; proc printto log=ft45f001; data _null_; infile ft44f001; run;

proc printto; run;

data _null_; length session $128; infile ft45f001 dlm=' ,' dsd; input @; if index(_infile_,'SESSION=') then do; input @'SESSION=' session; putlog 'NOTE: ' session=; lastcolumn=cat('col',scan(session,-1,'C')); call symput('last_column',lastcolumn); firstcolumn=cat('col',substr(scan(session,-2,"C"),1, index(scan(session,-2,"C"),":")-1)); call symput('first_column',firstcolumn); stop; end; run;

*Input the desired data; data want; infile ft44f001 dlm='09'x dsd missover; *Set informats as needed; informat &first_column.-&last_column. $5.; input &first_column.-&last_column.; run;

Very much appreciated .. as always! Art ----------- On Jul 12, 7:33 am, datan...@GMAIL.COM ("data _null_,") wrote: > On 7/11/08, Arthur Tabachneck <art...@netscape.net> wrote: > > > However, like I said, vbs and the macro/abbreviations wouldn't be needed > > if someone can figure out how to get the triplet directly via the > > CLIPBOARD method. > > Not exactly what I would call directly, but it does get the value of > LastColumn from the dde triplet. PROC PRINTTO is alive and well in > SAS version 9. I expect it will live on in infamy. > > SAS knows this data because it prints it on the log. Perhaps there is > a more direct way using PEEKC but I don't have much experience using > that PEEKC outside the context of examples I've seen from DeVenezia > and Dorfman. But I will have a PEEK anyway. > > With regards to reading the feed through the DDE connection. The > NOTAB option is needed so that the tabs are not expanded and can be > used as column delimiters. > > dlm='09'x dsd missover > > On the infile DLM and importantly DSD are needed because multiple > blank fields come across with no space between the tabs. i.e. tabtab2 > is two missing fields followed by non missing. Rows with all missing > values come across as zero length records, so MISSOVER is needed it > you want those rows of all missing. This can been examined using the > LIST statement. > > 1 CHAR 1.2.3 5 > ZONE 30303 > NUMR 19293 > 2 0 > 3 0 > 4 0 > > 5 CHAR 1.. 3 > ZONE 300 > NUMR 199 > 6 0 > > 7 CHAR .2. 3 > ZONE 030 > NUMR 929 > 8 0 > 9 0 > 10 0 > 11 0 > 12 0 > > filename ft44f001 dde 'clipboard' notab lrecl=512; > filename ft45f001 temp; > > *** Find the last column number of the selection; > proc printto log=ft45f001; > data _null_; > infile ft44f001; > run; > proc printto; > run; > data _null_; > length session $128; > infile ft45f001 dlm=' ,' dsd; > input @; > if index(_infile_,'SESSION=') then do; > input @'SESSION=' session; > putlog 'NOTE: ' session=; > lastColumn = scan(session,-1,'C'); > call symputx('LastColumn',lastcolumn); > stop; > end; > *list; > run; > > *** Read the data assume all numeric data; > data excel; > infile ft44f001 dlm='09'x dsd missover; > array c[&lastcolumn]; > input c[*]; > list; > run; > proc print; > run;


Back to: Top of message | Previous page | Main SAS-L page