Here's a syntax for naming your file:
yes? let station = ..station_name
yes? let filename = "`station`.dat"
!-> DEFINE VARIABLE filename = "Acapulco.dat"
yes? list/file="`station`.dat" ...
We don't have all the flexibility in writing string variables to ascii text files that one might want. But because you want to write the same string to all the records in this LIST command, we can set it up using the LIST/FORMAT= , doing something like this
8.4, " `station`")
(f8.4, " Acapulco") ssh
and the file will have
Another option would be to use /precision= instead of /format= . This will be needed if station is a string variable that's changing along with the numeric variables you're writing; but gives less control over the exact format.
ecision=6 ssh, station
which gives you,
On 4/19/2017 6:14 PM, Paul Goddard wrote:
I am having trouble with how to use strings;....and how to word my question, so I will provide an annotated example:
My data contains an attribute for station_name
Yes? let station = ..station_name
Yes? list/nohead station
I would like to use this string, "Acapulco" in two ways:
1\ I want to insert the string into the name of a file, such that when I am using a repeat loop
the program will do something like:
Yes? list/format=(2f8.4)/file = `station`.dat SSH
!-> list/format=(2f8.4)/file =Acapulco.dat SSH
2\ I also want the string to become a variable so that when I save my data file, one of the columns says Acapulco and next to it will be the SSH value.... so something like:
Yes? list/format=(2f8.4)/file = `station`.dat `station`,SSH
!-> list/format=(2f8.4)/file = Acapulco.dat Acapulco,SSH
Thanks in advance,