f



parsing output into output files within a macro + variable naming of files

With the help of this forum I've arrived at this macro.  It produces output=
 for each iteration into one excel file.  I would like to have the output p=
arsed into a file per run of the do command and to have each of these files=
 named for the value of the iterated variable on that run. Currently, only =
one file is produced with all of the output and it is named #filename.=20

GET FILE=3D'/desktop/employee.sav'.
GET FILE=3D'/desktop/employer.sav'.



define !cbook=20
  (splitvar =3D !TOKENS(1) /=20
   start =3D !TOKENS(1) /=20
   finish =3D !TOKENS(1))=20


!do !i =3D !start !to !finish=20




DATASET ACTIVATE DataSet1.
temporary.=20
select if (!splitvar EQ !i).=20


CODEBOOK  color [n] fruit [n] car [s]=20
  /VARINFO LABEL TYPE VALUELABELS
  /OPTIONS VARORDER=3DVARLIST SORT=3DASCENDING MAXCATS=3D200
  /STATISTICS COUNT.


USE ALL.
COMPUTE filter_$=3D(car=3D1).
VARIABLE LABELS filter_$ 'car=3D1 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.
CODEBOOK  car [s] tree [s] color [s]
  /VARINFO LABEL TYPE VALUELABELS
  /OPTIONS VARORDER=3DVARLIST SORT=3DASCENDING MAXCATS=3D200
  /STATISTICS COUNT.

USE ALL.

DATASET ACTIVATE DataSet2.
temporary.=20
select if (!splitvar EQ !i).=20

CODEBOOK  color [n] fruit [n] car [s]=20
  /VARINFO LABEL TYPE VALUELABELS
  /OPTIONS VARORDER=3DVARLIST SORT=3DASCENDING MAXCATS=3D200
  /STATISTICS COUNT.


USE ALL.
COMPUTE filter_$=3D(car=3D1).
VARIABLE LABELS filter_$ 'car=3D1 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.
CODEBOOK  car [s] tree [s] color [s]
  /VARINFO LABEL TYPE VALUELABELS
  /OPTIONS VARORDER=3DVARLIST SORT=3DASCENDING MAXCATS=3D200
  /STATISTICS COUNT.


USE ALL.

Compute #filename =3D !i.

* Export Output.
OUTPUT EXPORT
  /CONTENTS  EXPORT=3DALL  LAYERS=3DPRINTSETTING  MODELVIEWS=3DPRINTSETTING
  /XLS  DOCUMENTFILE=3D'/Users/dmello/Desktop/#filename.xls'
     OPERATION=3DCREATEFILE
     LOCATION=3DLASTCOLUMN  NOTESCAPTIONS=3DYES.


!doend.=20



!enddefine.=20

!cbook splitvar =3D color  start =3D 1 finish =3D 3.=20

0
spssdan
5/24/2012 5:56:02 PM
comp.soft-sys.stat.spss 5679 articles. 0 followers. Post Follow

1 Replies
769 Views

Similar Articles

[PageSpeed] 43

*** It doesn't work like that.  You can not arbitrarily stuff the value of a scratch variable into a string literal!!!
.......
.......
 DOCUMENTFILE=!QUOTE(!CONCAT(!UNQUOTE('/Users/dmello/Desktop/filename'),!I,!UNQUOTE('.xls'))) ..........

You might be able to lose the !UNQUOTEs but I don't have time to test either of these right now.
 DOCUMENTFILE=!QUOTE(!CONCAT('/Users/dmello/Desktop/filename' ,!I,'.xls')) ..........

"
Compute #filename = !i.

* Export Output.
OUTPUT EXPORT
  /CONTENTS  EXPORT=ALL  LAYERS=PRINTSETTING  MODELVIEWS=PRINTSETTING
  /XLS  DOCUMENTFILE='/Users/dmello/Desktop/#filename.xls'
     OPERATION=CREATEFILE
     LOCATION=LASTCOLUMN  NOTESCAPTIONS=YES.
!doend.
"
0
David
5/24/2012 7:35:16 PM
Reply:

Similar Artilces:

output file name based on original file name
I have a simple txt parsing script that I'd like to have the output be named after the original text file. original = original.txt output = original_output.txt I'm just doing a simple file.open, and couldn't find anything. File.open('output.txt', 'w') do |f2| File.readlines("original.txt").each do |line| Thanks in advance for any help. -- Posted via http://www.ruby-forum.com/. Collin Moore wrote: > I have a simple txt parsing script that I'd like to have the output be > named after the original text file. > > original = original.tx...

Parse Text File and Output to File
I am using Perl to parse a text file and output to another file. The text file has data on Unix virtual memory (vmstat) and I want to delete lines that I don't want and output lines that I want to a new file. The script I have is giving me blank lines in the new file. #!/usr/local/bin/perl #program to read systemdata file #and write to systemstats file # # $file = '/users/rit0/g3/jml9810/metrics/systemdata'; open(INFO, $file); #opens file systemstats open(DATA, ">systemstats");#file to write data to @lines = <INFO>; #assigns lines to array foreach...

Parse Text File and Output to File
I am using Perl to parse a text file and output to another file. The text file has data on Unix virtual memory (vmstat) and I want to delete lines that I don't want and output lines that I want to a new file. The script I have is giving me blank lines in the new file. #!/usr/local/bin/perl #program to read systemdata file #and write to systemstats file # # $file = '/users/rit0/g3/jml9810/metrics/systemdata'; open(INFO, $file); #opens file systemstats open(DATA, ">systemstats");#file to write data to @lines = <INFO>; #assigns lines to array foreach...

output data from m-file to an output.dat file
How do I go about getting data to output continuously from a matlab m file. I have a program that loops thru for 6 sending surfaces and 6 receiving surfaces that are square shape. I want to then output the shape factor between the surfaces into a 6 by 6 matrix in an output file named output.dat. How do I do this, I have tried to do this with no avail. What is the syntax of how this would work? Thanks for any help. ...

redirect output to a file named by variable
Hi, I'm trying to use a variable to determine the name of a file to write output to. So, wishing something like this cartoon would actually work: echo 1 2 3 | awk '{fn="xy"; print > fn.csv}' Is this possible at all? Cheers, -- Seb On 15.02.2011 00:48, Seb wrote: > Hi, > > I'm trying to use a variable to determine the name of a file to write > output to. So, wishing something like this cartoon would actually work: > > echo 1 2 3 | awk '{fn="xy"; print > fn.csv}' I suppose you mean awk '{fn="xy"; print > fn".csv"}' (a variable fn concatenated with a string literal ".csv") Janis > > Is this possible at all? > > Cheers, > On Tue, 15 Feb 2011 01:01:07 +0100, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote: [...] > I suppose you mean > awk '{fn="xy"; print > fn".csv"}' > (a variable fn concatenated with a string literal ".csv") Thanks Janis, for some reason I was under the impression that a variable can't go to the right of ">" in awk. Should have given it a try first! -- Seb ...

Naming output variables from m-file
hi, i have three data vectors (100x1), called A, B, and C. I am writing a function m-file that calculates a simple operation (the change in teh last two observations in teh vector) last = data(end) -data(end-1); how can i modify this so that i can pass all three verctors through this, creating three variables: last_A, last_b, and last_C any help would be aprpeciated! db "dan berkowitz" <aim120c5@gmail.com> wrote in message <i79ort$rjf$1@fred.mathworks.com>... > hi, > > i have three data vectors (100x1), called A, B, and C. > > I a...

SPSS macro variable in file name
Hello everyone, I'm trying to save a data file out of SPSS. I want the name of the data file to contain the value of the macro variable I've assigned. Every example I've seen on how to do that looks like this: SAVE OUTFILE=!QUOTE(!CONCAT("c:\Temp\new file ",!var,".sav")). where !var is the macro variable. However when I run that line I get a bunch of errors (enclosed below) and no new file. Any insights into this issue will be greatly appreciated. Thanks! Jenny Errors >Warning # 210 in column 14. Text: !Quote >A macro symbol is invali...

Extracting variables from multiple *.txt files and having the variable name dependent on the name of the *.txt file
I have about 30 *.txt files that have contain data in the same format. I'd like to extract a certain set of data from each of these files, and store them as their own variables, not in a matrix. Each file name is structured in the following way: name_20xx_yy.txt where xx reflects the 2-digit year and yy reflects the 2-digit month of each data set. I'd like to be able to create column vectors from the data set that reflect the different data sets that they come from, i.e. var_20xx_yy= name_20xx_yy(:,3) This way I will have 30 different var_xx_yy variables each reflect...

How to output to file the output of classregtree
The classregtree function returns a tree object. I am unable to find a method that can write to a simple text file the tree description. "Ashwin " <m_ashwin_81@yahoo.com> wrote in message news:i24h0g$13$1@fred.mathworks.com... > The classregtree function returns a tree object. I am unable to find a > method that can write to a simple text file the tree description. If you're looking to write to the file the description that is displayed when you type the name of the tree variable at the prompt, then use EVALC to capture that displayed output and write that st...

parse output screen ok but cant get desired output new file!
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one entire line from the file , headers as well > > >as just the desired body messages . > > > > > >fp = file("/home/chuck/pythonScript/testbox") > > >mb = mailbox.UnixMailbox(fp, > > >email.message_from_file) > > > > > > > > >mailout = file("/home/chuck/pythonScript...

Can ODS output multiple files named as the BY variable?
Hi, Test code: data test; length userid $3 num 8; input userid num; datalines; ABC 1 DEF 2 GHI 3 ; run; options nobyline; proc report nowd; by userid; columns userid num; define userid / width=10 display; define num / display; run; My desired output are files named ABC.{PDF|RTF|HTML|XLS|???}, DEF, GHI, etc. IOW I want a filename matching the value of the BY variable. Can this be done, perhaps by using PROC TEMPLATE? I could write everything to one big temp file, then post process it, checking for page break characters, etc. But that seems so 20th ...

Parse a list of matrices within a file (GlancePlus output)
All, I need to do some pretty basic (but complex to me) parsing of a text file... in this file i have a structure like the following: ~~~~~09/16/09 18:47:51 61.2 -----18:48:52 59.7 ********** GLOBAL METRICS ********** ------------ CPU METRICS ----------- GBL_CPU_TOTAL_TIME_CUM = 8 GBL_CPU_TOTAL_UTIL_CUM = 13 GBL_CPU_TOTAL_UTIL_HIGH = 13 GBL_RUN_QUEUE = 0 GBL_PRI_QUEUE = 0 GBL_CPU_QUEUE = 2 ------------ MEM METRICS ----------- GBL_MEM_PHYS = 64.0gb GBL_MEM_AVAIL = 52.5gb GBL_MEM_FREE = 30.1gb GBL_MEM_UTIL = 53 GBL_MEM_UTIL_CUM = 53 GBL_MEM_U...

"output to" a variable file name in ASA 9
I am writing an HL7 interface in an application in ASA9. I have no choice in the matter of version, as this is a commercial product outside my control. Anyway, I really need to use the "output to" statement to output my HL7 messages, and I need to place these messages in various UNIQUE file names. I cannot seem to figure out how to replace the OUTPUT TO filename with a variable. It would appear the EXECUTE IMMEDIATE command_name would do the trick with a dynamically created command, but this does not appear to work in ASA9. Does any one have any ideas? Thanks in advance....

Strings, html bulider, formula node, how to parse and output file names?
Hi all, &nbsp; Labview module/vi's running tests.&nbsp; There are 15 test categories and each category as 5 to 25 sub tests.&nbsp; In the vi, I have a test category name string and its numeric index for the test number (sub test). &nbsp; The output is going to be ON&nbsp;an html page, the info&nbsp;I want to create is a hotlinked file with the anchor tags, so the browser will open up the file if clicked on.&nbsp; So the test output will have the test name and a link to a text or rtf file. &nbsp; Now if LabView allowed string processing in the formula node? i...

Name a file with output
date +%d If the above would output 26(or whatever day it is) I would like it to create a file named 26(or whatever day it is). Please assist on how a shell script would do this. TIA, Dennis ================== d=$((date +%d)) # If you want to redirect output of a program: yourcommand > $d # If you just want to create the file: touch $d <XXdennismu@yahoo.XX.com rm the XX's (Dennis)> wrote in message news:PGuVf.34433$ty4.19224@tornado.rdc-kc.rr.com... > date +%d > If the above would output 26(or whatever day it is) I would like it to create > a file named 26(or whateve...

grabbing portions of a file to output files
hi. I have a file with this kind of structure: Hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx .......... ...... ...... xxxxx Hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx .... ..... .... xxxxx Hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...... ..... and so on....lines starting with 'H' are headers. I wish to get the parts of the file where line start with 'H' all the way till before the next 'H' and save to files of different names...how is the best way to do it ? thanks s99999999s2003@yahoo.com wrote: > hi. > I have a file with this kind of structure: > > Hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx &...

sed input file to output file
Hi I am trying to run the sed command on an input file, but I would then like to make the changes on the same input file and not on another output file called something else. I am having difficulty doing this. Thankyou -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Charles786 wrote: > Hi > I am trying to run the sed command on an input file, but I would then > like to make the changes on the same input file and not on another > output file called something else. I am having difficulty doing this. Take a look at the sed(1) manpage, and look for the -i or --in-place commandline op...

To output values to the same file for different outputs
Hi,I'm running a program which would take few values and writes them tooutput file which is text file. For next run those values are changedand run. I want the previous run values and the current run values onthe same file how could that be done?Please let me know. ram wrote:> Hi,> > I'm running a program which would take few values and writes them to> output file which is text file. For next run those values are changed> and run. I want the previous run values and the current run values on> the same file how could that be done?Please let me know.Simply open the file ...

Input from file and output to file
Hi, what is the easiest way of taking inputs from a file and writing outputs to a file? I need to take values from MATLAB. I also need to plot the outputs in MATLAB. Can anyone suggest an appropriate way of doing this? Thanks in advance. e. Emel wrote: > Hi, > > what is the easiest way of taking inputs from a file and writing > outputs to a file? I need to take values from MATLAB. I also need to > plot the outputs in MATLAB. Can anyone suggest an appropriate way of > doing this? If you read and write the files as ascii, then you can do this in both Matlab and VHDL in ...

Outputting to a log file and translating output
I want to output a command to a specific log and somehow with in that log for a certain event that happens with in it send a email out. This is what I have I was wondering since I am new to bash what areas I need to address. Also I would like to be able to either A. Run this script against a ip address or a ip list or list of commands .. And if List how would list look like just a normal list of ips separated by returns? This is part of my script I have so far. Keep in mind I am new to the bash process. #!/bin/bash #This is script to run snmpget on remote adtrans ip list and sends it to /var/log/snmp.log #Developed by Shane #Network Surveillance #ipaddr=/tmp/ip.list this is a attempt to do a ip list instead of inputing specific ips in script date echo "Waiting 60 seconds before next command takes place..." #snmpwalk -v 1 -c public 172.18.60.246:161 1.3.6.1.4.1.664.2.444.1.1.1.1.1 > /var/log/snmp.log echo `snmpwalk -v 1 -c public "$ipaddr"` exit 0 B. Once the output hits the log it will look like this SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.4 = INTEGER: 2 SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.5 = INTEGER: 2 SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.6 = INTEGER: 2 SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.7 = INTEGER: 3 SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.8 = INTEGER: 3 SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.9 = INTEGER: 4 SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.10 = INTEGER: 4 SNMPv2-SMI::enterprises.664.2.444.1.1....

COMPILE-FILE argument :OUTPUT-FILE
http://www.lispworks.com/documentation/HyperSpec/Body/f_cmp_fi.htm compile-file input-file &key output-file verbose print external-format output-file---a pathname designator. output-file can be used to specify an output pathname; the actual pathname of the compiled file to which compiled code will be output is computed as if by calling compile-file-pathname. this seems to suggest that if output-stream is an open file stream, its content is overwritten, not appended to. however, both clisp and sbcl treat an open file stream given as the output-file as the stream where the binar...

How to copy a file to a file with a prefixed file name
I'm trying to write a program that will archive selected files to an archive directory. The files in the archive directory will have a prefix in the format yyyymmdd-hhmmss-filename.ext. So, if the file is called "somefile.dat", then the filename in the archive directory should be "20090522-164325-somefile.dat". I'm using Clipper's COPY FILE command to do the copy. I can't figure out how to get the prefix in front of the file name. Creating the prefix string is no problem, but I can't figure out how to tack that onto the front of the filename. If I...

Output Pulses from MEX-File to Digital Output
Hi, i need to output a Digital Pulse (40 kHz) from MATLAB, I figured I must make a MEX-File for it, because MATLAB can not genarate such Frequencies. The documentation to learn how to make this is really big and thats just make me confused. So I will be thankful if somebody shows me an Example code to realize this. the needed Pulse is a Digital Output from my DAQ.board on Port A Line 7 , to control a Sensor connected to it. ...

Parse file names for string and then grep these files ??
Help, awk, sed, find, grep - How to combine these commands (or others) to solve my issue? I need to gather a list of files from 2 directories with a common string in the filename (for instance I would be looking for files with todays date and yesterdays present in the filename - like /home/myDir/myFile.20030916.out and /home/myOtherDir/myFile.20030915.out) I borrowed ydate from unix.about.com to construct these date strings. Once I have this list of files, I need to grep for a particular string and write these lines to a new output file. Maybe perl is really what I should be looking at, m...

Web resources about - parsing output into output files within a macro + variable naming of files - comp.soft-sys.stat.spss

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

Mozilla moves Firefox to variable release schedule
... schedule process "carefully" and learning "a lot" from it in the past years, Mozilla has announced that Firefox is now moving to a variable ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Staley: 'A lot of different variables...been a hard year'
... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

When your environment variables are showing
There are embarrassing moments in life. There is the teacher calling you out as a child in class as you stare out the window wistfully imagining ...

Resources last updated: 2/27/2016 10:57:09 PM