How to specify a certain output if more than one output files are open in spss - spss

I have 2 output files open. How do I specify to a certain output file when running the syntax in SPSS?

Your output windows have names that you can see in the upper left corner - e.g:
You can change this name if you want, so
output name "MyOutput".
You can activate any open output window using it's name, like this:
output activate "ThisOutput".
freq thisVar.
output activate "ThatOutput".
freq ThatVar.
Each freq command will run in it's designated output window.

Related

SPSS print a statement to the ouput window

What syntax do I use to print "hello world" in the output window?
I simply want to specify the text in the syntax and have it appear in the output.
You need the title command:
title 'this is my text'.
Note that the title can be up to 256 bytes long.
Alternatively, you could use ECHO also. ECHO is useful for debugging macro variable assignements where as TITLE is useful for neat/organised presentation of your tables with intension to perhaps export output results.
If you want to write arbitrary text in its own block in the Viewer rather than having it stuck in a log block, use the TEXT extension command (Utilities > Create text output). You can even include html markup in the text.
If you don't have this extension installed, you can install it from the Utilities menu in Statistics 22 or 23 or the Extensions menu in V24.
example:
TEXT "The following output is very important!"
/OUTLINE HEADING="Comment" TITLE="Comment".
Outfile here is used in an ambiguous way. The prior two answers (the TITLE and ECHO commands) simply print something to the output window. One additional way to print to the output window is the PRINT command.
DATA LIST FREE / X.
BEGIN DATA
1
2
END DATA.
PRINT /'Hello World'.
EXECUTE.
If you do that set of syntax you will actually see that 'Hello World' is printed twice -- one for each record in the dataset. So one way to only print one line is to wrap it in a DO IF statement and only select the first row of data.
DO IF $casenum=1.
PRINT /'Hello World'.
END IF.
EXECUTE.
Now how is this any different than the prior two commands? Besides aesthetic looks in the output window, PRINT allows you to save an actual text file of the results via the OUTFILE parameter, which is something neither of the prior two commands allows.
DO IF $casenum=1.
PRINT OUTFILE='C:\Users\Your Name\Desktop\Hello.txt' /'Hello World'.
END IF.
EXECUTE.

NotePad++ Changing Few Number Entries

Here is a simple lists where I like to change the numbers: the entries are as below and it got over 300 entries like it
tom112
smith113
harry114
linda115
cindy106
samantha147
It need to be changed to
tom212
smith213
harry214
...and so on.
Please assist using notepad++ regular expression.
Thanks.
Assuming it's just a matter of replacing a name followed by a number starting with 1 with the same number but starting with 2 instead:
Ctrl + H for search & replace.
Check Regular expression under Search Mode.
Next to Find what type or copy in ([a-zA-Z]+)1([0-9]+).
Next to Replace with type or copy in \12\2.
Click Replace All and that should do it.
Add any other characters that might appear in the name before the number inside the first set of brackets with a-zA-Z.

GNU-M4: Strip empty lines

How can I strip empty lines (surplus empy lines) from an input file using M4?
I know I can append dnl to the end of each line of my script to suppress the newline output, but the blank lines I mean are not in my script, but in a data file that is included (where I am not supposed to put dnl's).
I tried something like that:
define(`
',`')
(replace a new-line by nothing)
But it didn't work.
Thanks.
I use divert() around my definitions :
divert(-1) will suppress the output
divert(0) will restore the output
Eg:
divert(-1)dnl output supressed starting here
define(..)
define(..)
divert(0)dnl normal output starting here
use_my_definitions()...
I understand your problem to be a data file with extra line breaks, meaning that where you want to have the pattern data<NL>moredata you have things like data<NL><NL>moredata.
Here's a sample to cut/paste onto your command line that uses here documents to generate a data set and runs an m4 script to remove the breaks in the data set. You can see the patsubst command replaces every instance of one or more newlines in sequence (<NL><NL>*) with exactly one newline.
cat > data << -----
1, 2
3, 4
5, 6
7, 8
9, 10
11, 12
e
-----
m4 << "-----"
define(`rmbreaks', `patsubst(`$*', `
*', `
')')dnl
rmbreaks(include(data))dnl
-----

ISQL 7.3 (SuSE): Ace report output to more than one file or stdout

Does anyone know how I could trick Ace into outputing to more than one file or to a file and display simultaneously without having to write an external script?.. i.e. in the Ace spec OUTPUT REPORT TO PIPE or OUTPUT REPORT TO "filename.out" > /dev/tty01a
For piping to multiple files, you can use:
OUTPUT
REPORT TO PIPE "tee file2 >file1"
You can do more than two files if you want to, courtesy of the abilities of the tee program. Clearly, if you want the output to go to standard output as well as to a file, you pipe it to tee without the '>' redirection.
You can get the output to a pager if you use:
OUTPUT
REPORT TO PIPE "tee file1 file2 | less"

How to print Java code on A3 page avoiding line-wrapping

I have to print Java code that some times reaches 300 columns (characters per line) in A3 paper and whatever editor I use (e.g. textmate) wraps the lines in order to fit in A4 paper.
Any suggestions?
cheers,
Asterios
Your editor undoubtably has either a Page Setup dialog or a Preferences dialogue as part of the Print Dialogue which will allow you to set the Paper Size to use for printing.
Even Notepad supports this
I finally made it to print using enscript. Here is the command I used to print Java code into PDF (and the used the pdf to print).
enscript -r -Ejava -M A3 -C -f "Courier8" input.java -o - | ps2pdf - output.pdf
where:
-r prints in landscape mode
-C prints the line numbers
-f changes the font and size
-M sets the output media to A3 (default is A4)
-Ejava adds syntax highlighting (you can also use --color if you need
colors in syntax highlighting but
they are not nicely printed in
greyscale)
It seems unlikely that every editor tries to format for A4. Which other editors have you tried? Does textmate not have a page size option? (Hmm... seems not)
Try a different editor that does let you set page size. Word, even.

Resources