sas >> Help using notepad in SAS

by art297 » Tue, 20 Oct 2009 08:10:54 GMT

In response to one of last week's posts, one nice user pointed me toward the
window's command "note", or dm "note".

I particularly like it because it brings up a notepad, allows one to inc code,
and submit the code with the command notesubmit.

However, what I can't figure out is (1) how to clear the notepad before
including a file and (2) what command to issue to close the notepad window.

Anyone have any clue?

Art

sas >> Help using notepad in SAS

by djnordlund » Tue, 20 Oct 2009 08:31:30 GMT


> -----Original Message-----

Art,

I searched the SAS help using the term notesubmit and found a little bit of
information. One approach to clearing the notepad is to select edit ->
select all, and then edit -> clear. Not very elegant but it works. As far
as closing the window, click on the X in the corner of the window. I wasn't
able to find a command for specifically closing the window. Maybe someone
else can help.

Dan

Daniel Nordlund
Bothell, WA USA

sas >> Help using notepad in SAS

by Tom Abernathy » Tue, 20 Oct 2009 09:38:12 GMT

The END command will close the notepad window.

sas >> Help using notepad in SAS

by art297 » Tue, 20 Oct 2009 09:40:18 GMT

Dan,

Thanks for looking, but you found what I did.

The problem in more detail.

First, I created a file called c:\copy.sas which contained the following
lines:

%window GET_LIB
rows=8
columns=80
irow=1
icolumn=2
color=black

#2 @3 'Enter libname:'
color=gray
@30 libnm 30
required=yes
attr=underline
color=yellow
#3 @3 'Enter filename:'
color=gray
@30 memnm 30
required=yes
attr=underline
color=yellow;
%display GET_LIB;
proc sql noprint;
select name into :namelist
separated by ' '
from dictionary.columns
where libname=upcase("&libnm.")
and memname=upcase("&memnm.");
quit;
filename clippy clipbrd;
data _null_;
file clippy;
put "&namelist.";
run;

Then, I went to tools->options->keys and assigned the following to ctrl-f11:

note;inc "c:\copy.sas";notesubmit;

First time through it works perfectly. I.e., when window comes up I enter
sashelp for the libname and class for the filename and, when its done, I can
ctrl-v (i.e., paste) the variable names into a drop or keep statement.

But, multiple runs end up running the code twice, three times, and more.
Thus, the questions are (1) how to automagically delete notepad at the start
and (2) how to automagically close the window.

Art
--------
On Mon, 19 Oct 2009 17:31:30 -0700, Daniel Nordlund < XXXX@XXXXX.COM >


wasn't

sas >> Help using notepad in SAS

by djnordlund » Tue, 20 Oct 2009 09:44:13 GMT

gt; -----Original Message-----

Art,

I figured you had already done your due diligence, and that you were trying
to automate a process, but thought I would resond anyway since I have have
been wrong before and will be again. :-)

Dan

Daniel Nordlund
Bothell, WA USA

sas >> Help using notepad in SAS

by djnordlund » Tue, 20 Oct 2009 10:25:53 GMT

> -----Original Message-----

Art,

You can use the CLEAR command before your INCLUDE to keep from executing
multiple copies. I still don't have a command for closing the file (I
tried CLOSE, but it was ignored).

note;clear;inc "c:\copy.sas";notesubmit;

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA

sas >> Help using notepad in SAS

by Tom Abernathy » Tue, 20 Oct 2009 10:27:55 GMT

he problem with multiple copies is caused by NOTEPAD saving on exit
by default.
You should be able to fix this bye either using the CLEAR command to
clear the current window. (CLEAR should work the same in most windows
like LOG, OUTPUT, PGM, NOTEPAD) or the CANCEL command which is
supposed to do the same thing as the END command but without saving
the changes.

There is some documentation on commands in the windowing environment
at this page on SAS support site.
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001133533.htm

From my experience it helps to tell NOTEPAD which file you want to
edit. The syntax that I have used is the four level dot separated name
of a source object in a SAS catalog. For example: NOTEPAD
WORK.TEMPCAT.GET_LIB.SOURCE

For your program you could have your code in a permanent source object
rather than a external textfile. Or use a DATA STEP to write the code
into the source object using the CATALOG engine. For example:
FILENAME GET_LIB CATALOG 'WORK.TEMPCAT.GET_LIB.SOURCE';
data _null_;
file get_lib;
put '%window ... '
/ ....
;
run;

Then your function key would become
'notepad work.tempcat.get_lib.source ; notesubmit; end'

Or with your original external file why not just have the function key
be:
'gsub "%inc ''c:\copy.sas''"' -- Figuring out the proper quoting is
left as an exercise for the user :)




On Oct 19, 9:44m, XXXX@XXXXX.COM (Daniel Nordlund) wrote:
> > ir>w>1
> > ico>u>n=2
> > col>r=>l>ck
>
> > #2 3 Ente> >ibname:'
> > gt;gt;color=gray
> > gt;gt;@30 libnm 30
>>>>required=yes >>>> attr=unde>l>ne
> > color=yellow >>>> #3 3 En>e> filename:'
> > > > color=gray
> > > > @30 memnm 30
> > > required=yes >>>> attr=under>i>e
> > color>y>llow;
> > %display GET_LIB;
>>>>select name into :namelist >>>> separated by ' '
> > from>d>ctionary.columns
> > where l>b>ame=upca>e>"&libnm.")
> > and>m>mname=upcase("&>e>nm.");
> > quit> >> > filename clippy c>i>brd;
>>> >a>a _null_;
> > file c>ippy;
>>> put "&namelist.";
>
> > Then, I wen> t> >ools->options->keys and assigned the >> > >ollowing to ctrl-f11:
>
> > note;inc "c:\copy.sas";notesub>i>;
>
> > First tim> >hrough it works perfectly. .e., when window
> > comes up I e>t>r
> > sashelp for>t>e libname and class for the filename and, when
> > its done, I can
> > >tr>-> (i.e., paste) the variable names into a drop or keep stat>m>nt.
>
> > But, mu>t>ple runs end up running the code twice, three
> > times, >n> more.
> > Thus, the q>e>tions are (1) how to automagically delete
> > no>ep>d>at the>s>art
> > an> >2) how to automagically close the window.
>
> > Art >>>> --------
> > On Mon, >9 <gt;c> 2009 17:>1:>0>->>00, Daniel Nordlund
> >
> > wrote:
>
> > >> -----Original Message-->-> >> > >> From: SAS(r) Discussion >m>i>>o: XXXX@XXXXX.COM ] On
> > >> Beha>f>O>>Arthur Tabachneck
> > >> Sen>:>M>>day, October 19, 2009 5:11 PM
> > >>>To> >A>> XXXX@XXXXX.COM
> > >> Subject: Help using notepad in>S>S>>>
> > >> In response to>o>e>>f last week's pos

sas >> Help using notepad in SAS

by djnordlund » Tue, 20 Oct 2009 10:33:50 GMT

> -----Original Message-----

Art,

Sorry for the multiple posts, but try the CLEAR command to clear the notepad
window, and the END command to close the notepad window, something like
this:

note;clear;inc "c:\copy.sas";notesubmit;end;

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA

sas >> Help using notepad in SAS

by art297 » Tue, 20 Oct 2009 11:27:05 GMT

Dan,

Multiple posts are for Mastercard. Solutions are priceless!

The clear command definitely clears the notepad. And the end command
definitely makes the screen go away.

However, if you re-run the command, the notepad first comes up again, with a
prompt asking if you want to save it.

Regardless, this is the farthest I've gotten thus far. Very much
appreciated!

Art
-------
On Mon, 19 Oct 2009 19:33:50 -0700, Daniel Nordlund < XXXX@XXXXX.COM >


notepad

sas >> Help using notepad in SAS

by montura » Tue, 20 Oct 2009 19:47:46 GMT

Art,

Notepad works with program editor commands if you save the source code
to a catalog.
You need to set NUMS ON to get line numbers and it has a default "save
on exit" built it.

When I'm not programming SCL I still keep my Base/SAS programs in
catalog.
It's just easier for development, at least the kind not related to
tables listings and graphs.


Kevin

sas >> Help using notepad in SAS

by art297 » Tue, 20 Oct 2009 20:47:44 GMT

Dan,

Found the missing component. When one brings up SAS notepad, the 'end'
command won't work seamlessly unless notepad is set to not require user
verification on exit.

That can be set by typing 'edop' in the sas command line which, in turn,
allows one to change any of notepad's settings.

Art
---------
On Mon, 19 Oct 2009 19:33:50 -0700, Daniel Nordlund < XXXX@XXXXX.COM >


notepad

sas >> Help using notepad in SAS

by snoopy369 » Tue, 20 Oct 2009 22:59:07 GMT

I have to ask the stupid question:
What is the reason to use this method, over %include (in an automated
program)?

Thanks,
-Joe

sas >> Help using notepad in SAS

by art297 » Wed, 21 Oct 2009 01:17:42 GMT

Joe,

I'll be posting my solution to the original problem in a few minutes but
first decided to answer your question.

The SAS Notepad allows the statement 'notesubmit' which automagically
submits all of the code contained in the Notepad window. I.e., no
clicking on icons required.

Art
--------



window.

sas >> Help using notepad in SAS

by art297 » Wed, 21 Oct 2009 04:51:07 GMT

Joe,

My proposed solution to the original post can be found at:

http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0910c&L=sas-l&D=1&O=D&P=48981

Art
--------
On Tue, 20 Oct 2009 13:17:42 -0400, Arthur Tabachneck




toward
inc

Similar Threads

1. Notepad++ for SAS

2. Outputting SAS tables into notepad with positions

3. question on creating a dataset from a notepad file

Dear all,

I have a notepad file which has all the information regarding the
titles, table name, field type, table number, tabnum information in
it. I have to create a SAS dataset using this information.

For example,
program: demographics tabnum: 1.01 type: Table field: Demographic
Characteristics by Treatment Group and Trial:

I have around 1000 records like this in a notepad file. And what i
have to do is, i have to create a metadata set, in which i have to
create a variable
x - This variable will contain the information about the program name.
So if you can see the record that i have mentioned above demographics
is the name of the program. So variable x will have the value of
demographics

Similarly i have to create a variable y which will hvae information
about the field. Which in this case is Demographic  by Treatment
Group

In the same way i have to create varaibles for type and tabnum as
well.

I would appreciate if someone can tell me how to do this?

Regards,

4. "verifying the names of files in a folder with the names having in a notepad"

5. Help needed to produce a report using SAS

One possibility is to get all of your provider level information into BY
variables, then use the #BYVAR and #BYVAL tokens to insert these into title
lines. They would then appear at the top of every page, not just at the
start of the group.

But the report does not look particularly tabular, and since the easy-to-
use SAS reporting procedures are primarily geared to tabular information, I
suspect that you are going to end up doing a DATA step (FILE/PUT) report
anyway.

On Wed, 28 Sep 2005 12:59:41 -0700, Nancy Li < XXXX@XXXXX.COM > wrote:

>Dear SAS experts,
>
>
>
>I have a data set of providers and patients, in which there are one or
more patients for each provider. I would like to produce a report to
present each variable in the SAS data set in the following way.
The rovider namewill be the group variable, the information of each
provider will present on the top, and then the information of each patient
will follow the corresponding provider. The only way I thought is to use
PUT statement to do it, but it hard to perform. Does anyone have a better
idea? Any input would be highly appreciated.
>>
>>
>>
>>Thanks in Advance!
>>
>>
>>
>>Nancy
>>
>>
>>
>>             Quarterly Provider Report
>>
>>                        April through June 2005
>>
>>  Provider Name:       DAVID
>>
>>  # of eligible patients:  32
>>
>>  # of patients working with a health coach:  12
>>
>>  # of patients referred to the program by a Partner's clinician:  2
>>
>>  # of patients contacted:  12
>>
>>        Patients Working with a Health Coach
>>
>>  Patient Name:  CYNTHIA                                Medical Record
Number:  00000091
>>
>>  DOB:  8/13/1980                                         Relative Risk
Score:  0.39
>>
>>  Patient referred by:                                      Follow-up call
scheduled:  Yes
>>
>>  # of Inbound calls from the patient:  0                 # of outbound
calls to the patient:  2
>>
>>  Medication adherence discussed:  No                Lifestyle change
discussed:  Yes
>>
>>  Referred to a Partners social worker:  No            FYI notes sent to
PCP:  No
>>
>>  Coached regarding the following surgical conditions:
>>
>>  # of Mailings sent to patient:  3           Titles of Mailings:
*Knowledge Base Article*HW Connect - Sample plate
>>
>>  # of Videos sent to patient:  0            Titles of Videos:
>>
>>  Patient Name:  FLORENCIO                               Medical Record
Number: 00000223
>>
>>  DOB:  2/27/1900                                            Relative Risk
Score:  3.46
>>
>>  Patient referred by:                                         Follow-up
call scheduled:  No
>>
>>  # of Inbound calls from the patient:  1                   # of outbound
calls to the patient:  1
>>
>>  Medication adherence discussed:  No                  Lifestyle change
discussed:  No
>>
>>  Referred to a Partners social worker:  No              FYI notes sent to
PCP:  No
>>
>>  Coached regarding the following surgical conditions:
>>
>>  # of Mailings sent to patient:  0            Titles of Mailings:
>>
>>  # of Videos sent to patient:  0             Titles of Videos:
>>
>>
>>
>>
>>
>>---------------------------------
>>Yahoo! for Good
>> Click here to donate to the Hurricane Katrina relief effort.

6. Need help creating pdf files using SAS/GRAPH

7. need help using sas macro to proc import

Hi all,

I am trying to import 3sheets from a single excel file. The files are
not named...hence i am using sheet1 sheet2 sheet3. Currently I am using
3 procimport statements to transfer data into SAS. I know that by using
macros i can efficiently import in one step.Can anybody please suggest
me the macro? My code looks like this :

PROC IMPORT OUT= WORK.SHEET1
            DATAFILE= "C:\Documents and
Settings\Owner\Desktop\royals-1.
xls"
            DBMS=EXCEL REPLACE;
     SHEET="Sheet1$";
     GETNAMES=YES;
     MIXED=NO;
     SCANTEXT=YES;
     USEDATE=YES;
     SCANTIME=YES;
RUN;
PROC IMPORT OUT= WORK.SHEET2
            DATAFILE= "C:\Documents and
Settings\Owner\Desktop\royals-1.
xls"
            DBMS=EXCEL REPLACE;
     SHEET="Sheet2$";
     GETNAMES=YES;
     MIXED=NO;
     SCANTEXT=YES;
     USEDATE=YES;
     SCANTIME=YES;
RUN;
PROC IMPORT OUT= WORK.sheet3
            DATAFILE= "C:\Documents and
Settings\Owner\Desktop\royals-1.
xls"
            DBMS=EXCEL REPLACE;
     SHEET="Sheet3$";
     GETNAMES=YES;
     MIXED=NO;
     SCANTEXT=YES;
     USEDATE=YES;
     SCANTIME=YES;
RUN;

Thanks in advance 
SasL

8. Using SAS help