On Fri, 23 May 2008, Ignacio Diaz-Emparanza wrote:
Thank you, Jack. This works ok. I needed this variables as
strings so I only had to add the lines
sprintf year "%4f", yr
sprintf quarter "%2f", qt
If you just want year and quarter in string form:
<script>
open data9-3
scalar endobs=lastobs(reskwh)
sprintf send "%s", date(endobs)
sprintf year "%.4s", send
sprintf quarter "%s", send + 5
printf "year is %s and quarter is %s\n", year, quarter
</script>
or
<script>
scalar endobs=lastobs(reskwh)
sprintf send "%s", date(endobs)
string quarter, year
sscanf send, "%4s:%s", year, quarter
</script>
Allin