LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 16 Apr 1999 10:59:16 GMT
Reply-To:     Evanspuk <evanspuk@AOL.COMNOSPAM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Evanspuk <evanspuk@AOL.COMNOSPAM>
Organization: AOL, http://www.aol.co.uk
Subject:      Re: Get username from Windows

In article <7f6qei$fek$1@news.capgemini.se>, "Fredrik Hedvall" <Fredrik.Hedvall@capgemini.se> writes:

>Subject: Get username from Windows >From: "Fredrik Hedvall" <Fredrik.Hedvall@capgemini.se> >Date: Fri, 16 Apr 1999 09:54:04 +0200 > >Hi everyone! > >I need to obtain the username from the windows environment into an scl or >macro variable. Does anyone have a nice API-call which can fetch the userid? > >Yours > >Fredrik H

Fredrik

The following code will get the windows username for you. Obviously the lines between the cards; and ;;;; lines are what goes in to the SASCBTBL file.

Hope this helps

Peter Evans

filename sascbtbl 'winapi.txt'; run;

data _null_; infile cards truncover; file sascbtbl; input @1 record $char80.; put record $char80.; cards4; routine GetUserNameA module=ADVAPI32 minarg=2 maxarg=2 stackpop=called returns=short ; arg 1 char update format=$cstr20.; * User name ; arg 2 num update format=pib4. ; * User name length; ;;;; run;

data _null_; length userid $20; userid = ''; userlen = 20;

rc = modulen('GetUserNameA',userid,userlen); call symput('zuserid',userid); run;

filename sascbtbl clear; run;

%put NOTE: Windows userid = &zuserid;


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