Read in Multiple log files and output selected variables and values to cvs file

I have several problems with my problems: I hope you can help me.

1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error.

For example in filew.log if these items don't exist Memsize, SASFoundation and also if Real Time row value is less than 1.0 than no data is output to progflag.cvs.txt  
Results for Example: output - progflag,cvs.txt:
Memsize        Second      SASEXE                filename
    200                          SASFoundation        file1x.log.txt
    100                          SASFoundation        file2x.log.txt
    400         5.1                                         filez.log.txt

2) I am not getting any data in progflag.cvs.txt even though Memsize, and SASFoundation are in some of the log files that the program reads in

3) I am not receiving the progflag.cvs.txt attachment via email

4) I added *.log | awk  because I want the program to read in log files with the .log extension only. There are other files in the directory that have different extensions. I am getting an error message.
5) The program searches for 3 selected items in each log files.
Item 1# :  Memsize.  Memsize statement stores numeric values.  For example memsize=400. the program output the column name (memsize) and its value and the filename to progflag.csv.txt
 
example - output -   progflag.csv.txt:
memsize   Second    SASEXE       filename
 200                                        file1x.log.txt
Item 2# :  Real Time:    For example, variable Real Time stores a row value. Example Real Time:  0.1.

In my program  the variable Real Time alias name is  Second. If Second < 1.0 then output no data
For example in filez.log, Real Time: 0.1. IF SECOND  < 1.0 then no numeric value output to the column named Second in progflag.csv.txt
example - output -  progflag.csv.txt:
memsize   Second      SASEXE                        filename
100                         SASFoundation                file2x.log.txt
Item6# : another situation, if For example,  the row value for Real Time is 5.1 then output the numeric value to column name Second in  progflag.csv.txt.

IF SECOND  > 1.0 then output the value to the column in progflag.csv.txt
example - output - progflag.csv.txt:

memsize  Second      SASEXE       filename
 400         5.1                            filez.log.txt
item7#:   if the program finds  the directory path /SASFoundation (SASEXE) then output SASFoundation to column name sasexe in  progflag.csv.txt
cd /tmp/logs
*.log | awk -F '[=:;.]' '
  function pr() {if(NR>1) printf "%s\t%s\t%s\t%s\n", K[1],K[2],K[3],K[0]}
  BEGIN {
      printf "MEMSIZE\tSECOND\tSASEXE\tFilename\n"
      for(i=split("memsize ,Real Time ,SASFoundation",A,",");i;i--) L[A]=i
  }
  FNR==1 {
      pr()
       K[0]=FILENAME
      K[1]=K[2]=K[3]=x
  }
  $1 in L {v=$2;gsub("^[/ ]*","",v);gsub(/ *$/,"",v);K[L[$1]]=v}
  END{pr(
{if ($1 || $2>1.0 || $ 3 &&  $0) printf $1 "\t" $2 "\t"" $3"\t" $0"\t; elseif($2>1.0 else print ''}'
' *.log > progflag.csv

[ -s progflag.csv ] && mailx -s "subject text -a "Programs flagged" receiver@domain.com < progflag.csv