Hi All,
I am trying to save out regression coefficients using a macro, but can't seem to get it to work in /OUTFILE=COVB(!FILENAME) -- using !QUOTE(!CONCAT Etc. I have SPSS 11.0, so perhaps later versions have a new way of doing this. Any suggestions or workarounds? Thanks, Sam Michalowski, Ph.D. Coordinator of Research and Evaluation for Collaborative Programs City University of New York Office of Academic Affairs 101 West 31st St. 14-12 New York, NY 10001 646-344-7350 [hidden email] |
Sam...
This is from one of my existing code.. see if it helps.. Eg 1: SAVE OUTFILE= !outdir+ !QUOTE(!6) + !QUOTE(!5) + '.sav' . Eg 2: DO IF (condition). WRITE OUTFILE = !QUOTE( !CONCAT('C:\data\Itins',!1,'.txt') ) TABLE / 'Stuff... ' / 'SOme other stuff ' var. END IF. - San Halcrow (Sydney) On 2/9/07, Sam <[hidden email]> wrote: > Hi All, > > I am trying to save out regression coefficients using a macro, but can't > seem to get it to work in /OUTFILE=COVB(!FILENAME) -- using !QUOTE(!CONCAT > Etc. I have SPSS 11.0, so perhaps later versions have a new way of doing > this. Any suggestions or workarounds? > > Thanks, > > > Sam Michalowski, Ph.D. > Coordinator of Research and Evaluation for Collaborative Programs > City University of New York > Office of Academic Affairs > 101 West 31st St. 14-12 > New York, NY 10001 > 646-344-7350 > [hidden email] > |
I'm creating what amounts to passwords and i want to do this with a 6 digit random number + some character (either alpha or $, & etc).
I have my random numbers generated but is SPSS able to create random characters? Also would someone know how to put these 2 fields together? Thanks for you expertise Carol |
In reply to this post by Sam-90
Hi Sam,
I am not sure what you mean, but I think it's the following: /OUTFILE=!quote(!concat('COVB',!FILENAME,'.sav')) you can just specify the file name without its extension. The file will get a prefix 'COVB' --it's this part I'm not sure about. Cheers! Albert-Jan --- Sam <[hidden email]> wrote: > Hi All, > > I am trying to save out regression coefficients > using a macro, but can't > seem to get it to work in /OUTFILE=COVB(!FILENAME) > -- using !QUOTE(!CONCAT > Etc. I have SPSS 11.0, so perhaps later versions > have a new way of doing > this. Any suggestions or workarounds? > > Thanks, > > > Sam Michalowski, Ph.D. > Coordinator of Research and Evaluation for > Collaborative Programs > City University of New York > Office of Academic Affairs > 101 West 31st St. 14-12 > New York, NY 10001 > 646-344-7350 > [hidden email] > ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news |
In reply to this post by parisec
Carol,
Ok, so you want to make passwords of 6 numbers and one character, as for example, 888888E I think I'd do a draw from a uniform distribution, truncate the draw, then use that to pick out the letter from as string of length 26 filled with the uppercase letters of the alphabet, and put it all together with a concantenate command. Like this. String letters(a26). String password(a7) numbers(a6). Compute letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'. Compute draw=trunc(rv.uniform(1,27)). Compute password=concat(numbers,substr(letters,1,draw)). Gene Maguin |
In reply to this post by parisec
All,
A couple of us here have been having a discussion about cox regression plotting. One person says that in the past he has been able to plot the hazard function--not the cumulative hazard function. However, my syntax reference for 10 shows that even then the cumulative hazard was plotted. The Survival procedure will plot hazard functions with categorical covariates. My question is whether the hazard function can be somehow extracted from the available cox output and how that would be done. I notice that plotting the cumulative hazard is usually done. I curious why people wouldn't also want to see the hazard rate. Thanks, Gene Maguin |
In reply to this post by parisec
At 12:27 AM 2/9/2007, Parise, Carol A. wrote:
>I'm creating what amounts to passwords and i want to do this with a 6 >digit random number + some character (either alpha or $, & etc). > >Is SPSS able to create random characters? Also would someone know how >to put these 2 fields together? To answer the latter question, the result has to be a character field. Use the STRING function to convert your number, then catenate. To answer the first, you can get a random character by drawing a random integer in the appropriate range, and using it to look up in a list of characters. In the following, the 6-digit random numbers are selected from the full range, 0 to 999999, and are entered into the password with leading 0's where necessary. The following is SPSS 15 draft output. (Code & output not saved separately.) NEW FILE. INPUT PROGRAM. . NUMERIC LINE_NUM (F3). . String password(a7). . String #letters(a27). . Compute #letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ$'. . NUMERIC #Rand_Num (N6) /#Rand_Idx (F2). . STRING #Rand_Chr (A1). . LOOP LINE_NUM = 1 TO 5. . COMPUTE #Rand_Num = TRUNC(rv.uniform(0,1e6)). . COMPUTE #Rand_Idx = TRUNC(rv.uniform(1,28)). . COMPUTE #Rand_Chr = SUBSTR(#letters,#Rand_Idx,1). . Compute password = concat(STRING(#Rand_Num,N6), #Rand_Chr). . END CASE. . END LOOP. END FILE. END INPUT PROGRAM. LIST. List |-----------------------------|---------------------------| |Output Created |09-FEB-2007 14:16:29 | |-----------------------------|---------------------------| LINE_NUM password 1 324996Q 2 472388M 3 747540O 4 148345X 5 890948G Number of cases read: 5 Number of cases listed: 5 |
In reply to this post by parisec
Hi all,
Both Gene and Richard's solution worked great. I had generated random numbers in excel and imported them into SPSS. For Gene's solution to work... String letters(a26). String password(a7) numbers(a6). Compute letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'. Compute draw=trunc(rv.uniform(1,27)). Compute password=concat(numbers,substr(letters,draw,1)). I had to make sure my numbers were 6 digits or less. These are both great little programs i am likely to use again. Thanks Carol -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Richard Ristow Sent: Friday, February 09, 2007 11:18 AM To: [hidden email] Subject: Re: random number with alpha At 12:27 AM 2/9/2007, Parise, Carol A. wrote: >I'm creating what amounts to passwords and i want to do this with a 6 >digit random number + some character (either alpha or $, & etc). > >Is SPSS able to create random characters? Also would someone know how >to put these 2 fields together? To answer the latter question, the result has to be a character field. Use the STRING function to convert your number, then catenate. To answer the first, you can get a random character by drawing a random integer in the appropriate range, and using it to look up in a list of characters. In the following, the 6-digit random numbers are selected from the full range, 0 to 999999, and are entered into the password with leading 0's where necessary. The following is SPSS 15 draft output. (Code & output not saved separately.) NEW FILE. INPUT PROGRAM. . NUMERIC LINE_NUM (F3). . String password(a7). . String #letters(a27). . Compute #letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ$'. . NUMERIC #Rand_Num (N6) /#Rand_Idx (F2). . STRING #Rand_Chr (A1). . LOOP LINE_NUM = 1 TO 5. . COMPUTE #Rand_Num = TRUNC(rv.uniform(0,1e6)). . COMPUTE #Rand_Idx = TRUNC(rv.uniform(1,28)). . COMPUTE #Rand_Chr = SUBSTR(#letters,#Rand_Idx,1). . Compute password = concat(STRING(#Rand_Num,N6), #Rand_Chr). . END CASE. . END LOOP. END FILE. END INPUT PROGRAM. LIST. List |-----------------------------|---------------------------| |Output Created |09-FEB-2007 14:16:29 | |-----------------------------|---------------------------| LINE_NUM password 1 324996Q 2 472388M 3 747540O 4 148345X 5 890948G Number of cases read: 5 Number of cases listed: 5 |
Free forum by Nabble | Edit this page |